Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Update incident state field when specified 'on hold' date reached

foster1
Kilo Explorer

Hi, I'm going round in circles on this and hoping someone can help. I have set up the notifcation as mentioned in:
http://wiki.service-now.com/index.php?title=Creating_a_Simple_Reminder_Email
using an 'On Hold' date/time field in the Incident form (u_on_hold_expiry)

Condition: current.u_on_hold_expiry.changes()

Script: gs.eventQueueScheduled("Incident.reached.end.of.onhold.period", current, gs.getUserID(), gs.getUserName(), current.u_on_hold_expiry);

Event: Incident.reached.end.of.onhold.period

and this is working fine.
What I would like to do is reset the Incident state from 'On hold' to 'Active' at the same time i.e. when the 'current.u_on_hold_expiry.changes()' at the time set in the field, is this possible from the same Business Rule/event or does it have to be done separately? Any suggestions and/or assistance greatfully received.



Foster

5 REPLIES 5

lars-ake_bolk
Kilo Explorer

I guess you can try creating a new Script Action that triggers on your Incident.reached.end.of.onhold.period event.
Then you can write any javascript code you want; in this case changing incident state.
Good luck!


Dan Tolgyesi1
Tera Expert

Hi,

I also have this requirement to have an off hold date, did you have any success with being able to change the state?

Thanks
Dan


Hi Dan,
I now have a script that changes the incident state to 'Active' from 'Onhold' which works when the onhold expiry date is changed manually:

if(current.active == true&& current.incident_state == 😎 //state 8 is my onhold
{
current.incident_state = 1;
gs.addInfoMessage('Active incident' + current.number + ' reopened - Business rule.'); // just to display something to show it's working
current.update();
}

If the incident is 'On hold' and I update the expiry date then the state changes to active so the usiness Rule does work. However what I haven't found how to do is get it to trigger automatically when the expiry date is reached as the email notification does, any ideas?
I have looked at creating an event as per the notification but that hasn't worked so I'm now looking at triggering a script action.


Hi,

Thanks for your input I will have a play around to see what I can do and let you know the outcome.

Thanks
DAn