Zum Hauptinhalt gehen

Change filename on each generation

Kommentare

2 Kommentare

  • Zendesk API User
    Author: mbergmann - 3/19/2019 20:25

    Hi Andres,

    which UrlFactory does the generation task use? If it is one using so called „stored urls“, FirstSpirit remembers urls for each PageRef. But if I understand you correctly, it works when changing the filename manually in the SA, correct?

    In this case the reason is that during generation, FirstSpirit always uses the revision of all objects that is the most current at the start time of the schedule entry (not only the generation task within). This is to ensure a consistent state and avoids mixing different revisions in case objects are changed while the generation is running.

    So if you change the filename programatically in the schedule entry using a script task (which is in general the correct way to do it), this change is not reflected in a following generation task in the same schedule entry because it is „too late“.

    You can „reset“ the timestamp that is used to calculate the relevant revision by adding a script task AFTER your change but BEFORE the generation task containing the following line:

    context.setStartTime(new Date());

    Your script task that changes the PageRef must also save and release the pageref. For this, you must use „use own connection“ because you need a connection with write access.

    Michael

    0
  • Zendesk API User
    Author: mbergmann - 3/19/2019 20:36

    By the way, a good alternative might be to create your own UrlFactory that uses a centrally stored extension that is updated instead of the PageRef(s). The advantage is that you don‘t create a new revision of the PageRef(s) for each generation. If you only want to change the filename of one PageRef, I think the approach described in my previous post is ok but if that should be done for ALL (or many) of them every time, I‘d really recommend the UrlFactory approach.

    Michael

    0

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.