Understanding Workflows Set Values
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2017 10:30 AM
I've been working in ServiceNow for a couple years now but my teammates typically dealt with workflow creation. They practice some implementations that I've never understood and would like to clarify. When setting values, many times they will use a timer before the set values activity. I have been building out a new workflow and using set values within it. If the record had been updated thus triggering the next activity in the workflow, the set value will be saved as expected. In my case though, when an approval is given (thus the update is to the related requested approval record) and I have a Set Values activity there after... the update of value is not committed.
Why is this? Is there a way to invoke a save from the Set Values activity that I'm missing? And why does adding the timer do anything to help out the situation. I don't want to add these timers to my workflow and figure there must be another way.
Thanks,
- Labels:
-
Best Practices
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2017 11:07 AM
Hi Aaron,
So you mean that you have an approval activity, to which a Set Value activity is connected (to the approved part, say), and when the approval is given the flow skips the Set Value without setting it and just moves on?
harel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2017 11:40 AM
Can you attach screen-shot of your workflow activities ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2017 12:08 PM
What I've ended up doing is creating a run script that does a current.update() after the set value activity and that seems to work... but I don't like it, what is the use of a activity that doesn't fulfill its duty. If I stay with this script idea, i'll probably just set the values directly in the script so that there is only one activity.
Earlier in the workflow, there are set values that work just fine. I believe it is because an update of the ticket is what triggered the forward movement of the workflow... thus setting a value is taken care of much like an Action within a Before Business rule, its set before the record has been committed:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2017 12:22 PM
Set Values always works fine without a save. Also you dont need a current.update() in a run script as well.
Can you submit a record and do a show workflow. There could be some issue with SetValue in your workflow or there could be some validation, which may be stopping it from getting updated.
Also send a screenshot of the SetValue Activity.
Please mark this response as correct or helpful if it assisted you with your question.
