How to change the state when "due date" is reached?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-10-2015 02:05 AM
At this moment we have a "substate" called "Planned".
Also i have a sperated field called "Planned_Time".
Now the goal i want to achieve is that when this time is reached the "substate" will be empty and the "state" will be changed to "Assigned".
Is there anyone who has a proper script for this for the "Fuji" release?
I've tried different options from Business Rules to Workflows but none worked for me so far.
Thanks in advanced!
Berry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-10-2015 08:33 AM
What did you try for a business rule? It should be a simple matter of creating a business rule and then scheduling it to run on a given interval.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-10-2015 09:13 AM
Hi Berry,
I had a similar requirement to change the Incident state to Active from Pending when the Pending expiration date passed.
I have written a Scheduled job with below config
Run--> Periodically
Repeat Interval --> 5 mins
Run this script:
var gr = new GlideRecord("incident");
gr.addQuery('state', 4); // state is Pending
gr.query();
while(gr.next())
{
var diff = gs.dateDiff(gs.nowDateTime(), gr.u_pending_expiration.getDisplayValue(), true);
if(diff<0){
gr.state = 2; // state set to Active
gr.work_notes = "Pending Expiration time has passed";
gr.update();
}
}
Modify this script according to your requirement.
Hope this helps
Suraj Chauhan