- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
HI community,
I want to show error message on RITM when user tries to close RITM if SC tasks are not closed complete, i am not allowed to use BR. is there any way to accomplish this requirement.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Assalamualaikum @ShaziyaS4380655 ,
yes, you can do it by using Use a UI Policy + Client Script or Flow Designer with Error Logging
You may find below thread helpful:
- https://www.servicenow.com/community/itsm-forum/how-to-close-ritm-when-all-sctask-close-and-get-erro...
- https://www.servicenow.com/community/developer-blog/restrict-ritm-closure-when-sctask-is-open-using-...
- https://www.servicenow.com/community/itsm-forum/prevent-closure-of-ritm-is-catalog-task-is-open-and-...
If it is helpful, please hit the thumbs button please mark the answer as correct based on the impact!!
Kind Regards,
Shaik Mohammed Mustaq
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
how are they closing RITM?
Are they changing the State field and then saving?
If yes then Make State field as Readonly using onLoad client script + Display business rule if RITM has any 1 Catalog Task as Open
Something like this, please enhance
Display BR on RITM Table:
(function executeRule(current, previous /*null when async*/ ) {
// Query catalog tasks related to this RITM with state not closed
var taskGR = new GlideRecord('sc_task');
taskGR.addQuery('request_item', current.sys_id);
taskGR.addActiveQuery();
taskGR.setLimit(1); // We only need to check if any open task exists
taskGR.query();
g_scratchpad.hasOpenTask = taskGR.hasNext();
})(current, previous);
onLoad Client Script on RITM
function onLoad() {
// Check if server-side determined flag exists
if (g_scratchpad.hasOpenTask && !g_form.isNewRecord()) {
// Make the State field readonly
g_form.setReadOnly('state', true);
// OR you can also remove the choice value of Close Complete using g_form.removeOption('state',3);
}
}
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
you want to show error message or do some validation on UI.
Here flow won't help as it runs in server side.
The approach I shared should work fine based on which approach customer wants to take.
I believe I shared working solution for your question.
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Assalamualaikum @ShaziyaS4380655 ,
yes, you can do it by using Use a UI Policy + Client Script or Flow Designer with Error Logging
You may find below thread helpful:
- https://www.servicenow.com/community/itsm-forum/how-to-close-ritm-when-all-sctask-close-and-get-erro...
- https://www.servicenow.com/community/developer-blog/restrict-ritm-closure-when-sctask-is-open-using-...
- https://www.servicenow.com/community/itsm-forum/prevent-closure-of-ritm-is-catalog-task-is-open-and-...
If it is helpful, please hit the thumbs button please mark the answer as correct based on the impact!!
Kind Regards,
Shaik Mohammed Mustaq
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
@Me Being Mustaq
Walaikumassalam
SInce it is OOTB iam not allowed to write BR's,Client script, UI polciy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @ShaziyaS4380655 ,
Flow Designer can be used for customization, even in OOTB setups if permitted. You can trigger a flow when the RITM state changes, add a decision step to check if any related records are not "Closed Complete," and if there are open tasks, set a field on the RITM. Optionally, you can log an error or send a notification.
After that, use form layout or read-only conditions (if allowed) to prevent closure based on the value of that field.
If it is helpful, please hit the thumbs button please mark the answer as correct based on the impact!!
Kind Regards,
Shaik Mohammed Mustaq
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
inorder to add the trigger as when RITM state changes to closed complete , i dont see the sc_req_item into the table field
