Workflows- set values activity not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â03-19-2019 02:51 AM
Hi,
I am going through the learning plans provided by the ServiceNow developer portal.
I find it very useful and easy to follow but now I stuck at a challenge.
I have created a workflow to automate approval and task creation process.
If the approval is rejected then I set the state to "Closed Complete", this part works fine.
If the approval is given then I set the state to approved, then I create a task, wait for completion and depending on the result I either go to the end directly, or if it is 3 (Closed Complete) then I go to the same activity as after rejection to set the state to Closed Complete on the record in context.
But this last part doesn't work. When I check the actual context it shows that it was going through the right activities but the state remains Approved. So either the last set values activity was not executed or the record is not saved somehow.
But if I reject the approval then the same activity works fine, and the record is saved.
Any Idea?
Thanks.
- Labels:
-
Personal Developer Instance
-
Studio
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â03-19-2019 07:47 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â07-10-2019 07:58 PM
I guess there might be a business rule preventing the record to be closed. I would have tried adding a timer activity, maybe 2 -3 seconds, before the set values activity, just to verify that it is not because of the fact that the child task hasn't been marked as inactive (active=false) by the time the flow reaches set value.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â07-10-2019 07:36 PM
I have run into the same issue, however if I use the "Run Script" activity as suggested in the learning material, it works, but just not with the "Set Values" activity. I am wondering if the "Create Task" activity before it has changed the context for "Set Values", but I cannot figure it out.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â07-10-2019 08:18 PM
Hi
Please can you check the user manager. or else you set the user after that you can approve and reject the approval request from set default user.
Suppose if you have set the approval is user manager but that user is not having any manager so it will be auto approved . it will not reject .
Please check the user manager.let me know the any other query .
Thanks
Sanjay Bagri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â07-11-2019 06:30 PM
Ok, looks like no one has really understood this question yet. Please refer to this link for the related training exercise. At the end of this exercise, there is a challenge question asking to modify the workflow so it can set the NeedIt request to "Closed Complete" when the related task is closed. The hint mentions to use the "Run Script" activity to accomplish the challenge and it works fine. But what I was wondering was that instead of using the Run Script activity, why can't we just use the same "Set Values" activity that we have used in the previous steps to set the request State directly. So I went to replace the "Run Script" activity with a "Set Values" activity which is exactly the same one as the "Set Value" activity after the approval reject node, but it turned out the "Set Values" in here DID NOT WORK AS EXPECTED! I was wondering why, and I spent some time trying to figure it out but I couldn't.