- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-01-2018 03:35 AM
Hi,
I have the following Problem:
I have a catalog Item, that can be requested via Form. Once Requested, a workflow will be triggered on this Item.
The Item includes data to activate an AD User. But the activation time depends on the input. If the input says, the user should be activated in one month, then the workflow needs to wait there for one month.
And because the workflow might be running and waiting for a long time, I want to be able to cancel it (changing the state of the request).
Is that possible? And what is the best way to implement this in ServiceNow?
Thanks
Solved! Go to Solution.
- Labels:
-
Best Practices
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-01-2018 04:05 AM
Yes if you choose "Timer based on script" then you can calculate the amount of seconds it should wait - pr RITM depending on your input.
If the input says, the user should be activated in one month, then the workflow needs to wait there for one month.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-01-2018 03:50 AM
Hi
In a wait condition activity you can put an answer to the amount of seconds the wait timer have to wait before continue.
So depending on your input you can convert it to seconds and parse it into the wait condition through workflow.scratchpad
I dont know if your input is a date/date time (if so gs.dateDiff() can be used to calculate the amount)
https://docs.servicenow.com/bundle/jakarta-application-development/page/app-store/dev_portal/API_reference/GlideSystem/concept/c_GlideSystemAPI.html#ariaid-title17
If its x days you can calculate it with x days * 24 * 60 * 60
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-01-2018 04:01 AM
So you mean, I defined a timer, that waits as long as it needs. On the right moment, the result will be set to true. Setting the value to true, would let it then continue?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-01-2018 04:05 AM
Yes if you choose "Timer based on script" then you can calculate the amount of seconds it should wait - pr RITM depending on your input.
If the input says, the user should be activated in one month, then the workflow needs to wait there for one month.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-01-2018 04:09 AM
I see. Timer based on a script is the better way to go