Order Guide - Allow incomplete requested items?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2024 02:01 AM
Hi All!
I have a requirement via an order guide with 3 catalog items.
Currently (and I believe ootb), when any one of the 3 Requested items are closed skipped or closed incomplete, it is auto updating the Request as closed incomplete.
Is there a way to prevent this on the Request state? So, if any ritm's are closed skipped or incomplete, do not cancel the overall Request?
Thank you,
Alex
#orderguide #catalog #process #request
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2024 03:10 AM
Hi @alex2410
By default (out-of-the-box), if any one of the RITMs is set to a "closed incomplete" or "closed skipped" state, the REQ record's state may also be updated to "Closed Incomplete."
To change this behavior and prevent the overall Request from being marked as "Closed Incomplete" when any RITMs are incomplete or skipped, you can modify or override the behavior using a Business Rule on the sc_request table.
Condition :- state changes to Closed Incomplete
var ritmGR = new GlideRecord('sc_req_item');
ritmGR.addQuery('request', current.sys_id);
ritmGR.addQuery('state', '!=', 'closed_incomplete');
ritmGR.addQuery('state', '!=', 'closed_skipped');
ritmGR.query();
if (ritmGR.hasNext()) {
current.state = previous.state; // Reset the state back to what it was
}
})(current, previous);
If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!
Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI
YouTube: https://www.youtube.com/@learnservicenowwithravi
LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2024 04:10 AM
Hello @alex2410 ,
You can use below code for your requirement :
Just gave order to maximum so it will run at the end.
If above solution works for you then please mark my answer as Helpful !
Thank You !
Regards,
Pradnyesh.