I have a 'create new record trigger' with a condition formula which works fine when started manually on all records. When I use the trigger in combination with a batch job, the trigger doesn't seems to take into account the condition formula in a correct way because it creates (probably due to incorrect condition formula) more records then based on the conditions. Does anyone encounter the same problem?
Hello Freddy,
could you please tell me more about the trigger type and trigger condition formula?
Thanks,
Corey Prak
trigger type is new record and I am using a conversion map to create a new record of a different object type.
The condition formula is:
var d1 = new Date(rbv_api.getCurrentDate());
var d2 = new Date("{!geldigheidsdatum_pas}");
d1.setMonth(d1.getMonth() + 3);
if("{!status#code}"=="Actief"){
d1>d2
}
else {
false
}
Hello Freddy,
thanks for the quick reply. Could you now please explain the expected behavior and actual behavior? I'd appreciate it. Logically, the trigger condition formula seems to be fine.
Thank You,
Corey Prak
Hello,
I believe the rbv_api.getCurrentDate() function takes into account the logged in user's settings.
It won't work in batch jobs as batch jobs are not being processed "as a user".
This may be the reason why you encounter a different behaviour on this trigger when processing it manually or in batch jobs.
I would just use "var d1 = new Date();".
If you want to be more precise, i guess you could do something like :
var d1 = new Date();
if (rbv_api.isUI()) {
d1 = new Date(rbv_api.getCurrentDate());
}
Romain.