yuuvis® RAD Q&A

0 votes
by (640 points)

There is a sample script for that:
https://developer.enaio.org/display/DD/BPM Server-Side Scripting#BPMServer-SideScripting-Updatethefiredateofatimeperiod

I had failed to make it work for Enaio version 3.36.
Is it for 4th generation only?

In my case timer is binded to end the work item and in Inbox there is visual information when timer will end the active workitem.

When I use script to update timer's fireDate dynamically for example in 'BeforeStartActivity' script section for particular workitem, it doesn't affect the timer.

I do use '$.done()' to save changes and can verify made changes from log file - I use '$.log.info' to output the '$.process.periods' object and see that changes had been applied, but work-item ignores the new deadline.

2 Answers

0 votes
by (350 points)

Hi Ingus,

just a guess: try avoiding capital letters like in the example skript
'process.periods.myPeriod; --> 'process.periods.myperiod;

it fixed my problem with another example skript.

Best
Kai

by (640 points)
Hi, Kai,

thank you for response.
Still no luck, the same issue when using single word lowercase period name (I also tried excat 'myperiod' name)

I can see that value of 'fireDate' key had been updated when outputing to BPM's log file, still process doesn't fire it up, but uses the original fireDate value which was configured in enaio designer.
0 votes
by (640 points)

Finally I got it working.
That it is not date object that should be set as fireDate's value as example shows, but text string representing the date in ISO format.

I had wasted much of my time hunting down this "feature", please adjust the dev. guide's misleading sample from this:

var myPeriod = $.process.periods.myPeriod;      // the periods array on the process object contains all periods
var newValue = new Date();                      // using Oracle´s Date class to generate a new date object
newValue.setFullYear(2022);
newValue.setDate(5);
newValue.setMonth(4);
newValue.setHours(12);
newValue.setMinutes(0);
myPeriod.fireDate = newValue;
$.done();                                       // call the 'done' function to save changed values

to this:

var myPeriod = $.process.periods.myPeriod;      // the periods array on the process object contains all periods
var newValue = new Date();                      // using Oracle´s Date class to generate a new date object
newValue.setFullYear(2022);
newValue.setDate(5);
newValue.setMonth(4);
newValue.setHours(12);
newValue.setMinutes(0);
myPeriod.fireDate = newValue.toISOString(); //sets date in a String, using the ISO standard
$.done();                                       // call the 'done' function to save changed values
by
Hi Ingus,
sorry for the wrong description. I will check this in the code and in the documentaiton. Thank you for this hint.
best regards
Christian
by
...