Trigger Workflow Timer 5 days before a specific Date/Time given in RITM variable value

subhadeep1618
Tera Guru

Hello Everyone,

Need one help.

I have a requirement to trigger a timer if current date is 5 days or less than estimated_end_date (which is a RITM variable).

Now this date is editable, that is, users can edit the variable value anytime.

In the workflow timer script, I have written the below code, but sadly the timer is not firing.

Can you please tell me where I am going wrong here.

Thanks in advance.

var diff = gs.dateDiff(gs.nowDateTime(), current.variables.estimated_end_date, true);
var days = diff / (24 * 60 * 60);
if (days <= 5) //if no. of days is 5 or less
    answer = 0;
else
    answer = 1000000; //an arbitrary large value if no. of days is more than 5

 


Please mark this post as a solution and also as helpful, if this resolves your issue or query.

Thanks,
Subhadeep Ghosh.
11 REPLIES 11

Hi @Tai Vu 

on which table we have to write this Business Rule?


Please mark this post as a solution and also as helpful, if this resolves your issue or query.

Thanks,
Subhadeep Ghosh.

Hi @subhadeep1618 

It's on the Requested Item [sc_req_item] table.

Beside the condition checking the variable changes, you can also add more condition to specific the rule trigger only on your Catalog item.

 

Cheers,

Tai Vu