Error message on request item when user closes the request item record without closing the sctasks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-25-2023 06:13 AM
Error message on a request item when the user closes the request item record without closing the catalog tasks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-25-2023 07:23 AM
Hi @maheshch18 ,
You can right before BR on request item table:
var ga=new GlideRecord("sc_task");
ga.addQuery('request_item', current.sys_id);
ga.addEncodedQuery('stateIN-5,1,2');
while(ga.next()){
gs.addErrorMessage("Please close child tasks");
}
Please mark helpful and accept solution if it helped you.
Regards,
Shivangi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-25-2023 07:55 AM - edited ‎08-25-2023 07:56 AM
Hello @maheshch18 ,
Create Before Business Rule on Requested Item table
Update checkbox: True
Use this script:
var gr = new GlideRecord('sc_task');
gr.addEncodedQuery('stateIN-5,1,2^ORactive=true');
gr.addQuery('request_item', current.sys_id);
gr.query();
while (gr.next()) {
gs.addErrorMessage('Please close the SC task(s) before resolving the request item');
current.setAbortAction(true);
}
Help others to find a correct solution by marking the appropriate response as correct answer and helpful.
Thanks,