RITM state set to 'Closed Complete' when approval is Rejected
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-30-2024 02:30 AM
I am using the flow designer for the catalog item process and when the approval is rejected, the stage is set to Request Cancelled but the state of RITM always set to Closed Complete. We would want it to be Cancelled or Closed Incomplete.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-30-2024 03:22 AM
Hi, I am trying to find the script which sets the state to Closed Complete when the stage is set to Request Cancelled but I didnt find any so far. Also, looking into the other scripts.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-27-2024 12:49 AM
Hi @SunilKumar_P ,
If its still not working you can try writing BR to set the state value of both ritm and request,
You can Try after update BR
Table: sc_req_item
condition as shown below,
Note: better to keep your catalog item in condition so that it will not run for others,
In action, to update requested item state
Please mark this comment as Correct Answer/Helpful if it helped you.
Regards,
Swathi Sarang
In advanced, to update Request table
code
(function executeRule(current, previous /*null when async*/) { var reqUpdate = new GlideRecord('sc_request'); reqUpdate.addQuery('sys_id',current.request); reqUpdate.query(); if(reqUpdate.next()){ reqUpdate.state = 4 ; reqUpdate.request_state = 'closed_cancelled'; reqUpdate.update(); } })(current, previous);
Please mark this comment as Correct Answer/Helpful if it helped you.
Regards,
Swathi Sarang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-30-2024 02:43 AM
Hello @SunilKumar_P
Can you please check in flow after Approval rejected branch, there should be 'Update record' (Requested Item) activity.
Please check there if state has been set correctly...
It will be better if you provide screenshot of your flow....!!
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-30-2024 02:59 AM
Hi @Vishal Birajdar, Thanks for the response. I have the update record 'action' and even though the flow sets the state to cancelled, the system overrides it to Closed Complete.
Thanks,
Sunil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-30-2024 03:04 AM
Here is the screenshot.