- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2018 10:51 AM
So, we currently have a Catalog Item that has a workflow attached to it. The workflow runs off of the sc_req_item table and has some Approvals. I have it set so that if an Approval is rejected, the workflow goes to a "Set Values" action that sets the "State" of the RITM to "Closed Rejected", and then sends out a Notification and goes to the End.
Whenever I test one, and Reject an Approval, it looks like it is going down the correct Workflow path, but for some reason my State appears to be overwritten, as it is always set to "Closed Complete". And it isn't just this one workflow, but this appears to be happening to all of our workflows that are trying to set the State to "Closed Rejected".
Here is what my action looks like.
I have tried it with various different values for Stage ("Request Cancelled" or "Completed"), but it does not appear to make any difference.
We checked the Business Rules, and I could not find any which appear to be interfering with this. Is there anything else which could be causing this to happen? How can I find out what is causing this?
Thanks
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2018 10:14 AM
It turns out that there was another Business Rule affecting this. It just wasn't where we were looking. It was a Business Rule on the Task table, and it wasn't one that we created (but by the ServiceNow team that got us up and running on ServiceNow a few years ago).
Also, in case others come across problems like this in the future, here is another article which may be helpful. https://community.servicenow.com/community?id=community_blog&sys_id=264d6229dbd0dbc01dcaf3231f96195a
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2018 12:21 PM
Could try putting like a 5 minute timer activity after you set the state to "Closed Rejected" and see if it changes although you should see that activity in history. Possibly even try a run script and set "current.state" instead of the set value activity.
Please mark this response as correct and/or helpful if it assisted you with your question.
Steven
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2018 12:40 PM
So, I replaced it with a Run Script that only does the following and added the 5 minute timer. Here is what the "Run Script" code looks like:
current.state = 'closed rejected';
And nothing happened (stayed in an "Open" state).
So I tried using the value instead (and keeping the 5 minute timer):
current.state = 8;
and it immediately went to state "Closed Complete", even with the 5 minute timer.
So it looks like it is completely bypassing this state.
I double-checked to make sure that there were not any other Choices in the Choice list for that element with a value of 8, and there are not.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2018 12:49 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2018 12:55 PM
As you pointed out, "Pending" is an out-of-the-box choice, while "Closed Rejected" is not. If you add a custom value of "Closed Rejected" to your choice list, can you still set it to that value?
It seems to me that the two most likely issues are:
- For some reason, it won't set it to Custom added values to that choice list
- There is something else overriding my change
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2018 01:03 PM
You have something overriding your changes or something else happening since it's just skipping your setting of the state value. The custom "Closed Rejected" state worked fine in my instance with just a 1 minute wait this time:
Please mark this response as correct and/or helpful if it assisted you with your question.
Steven