PrashantLearnIT
Giga Sage

Hello Everyone,

In this video, I will cover scenario-based solutions which our implementations might require in various projects.

I have explained How to Restrict RITM Closure when SCTASK is Open using Business Rules.

 

 

==========================BUSINESS RULES============================

Table - Requested Item
When to Run - Before Update
Condition - State is One of Closed States
Script -
(function executeRule(current, previous /*null when async*/ ) {

// Add your code here
var scTask = new GlideRecord('sc_task');
scTask.addActiveQuery();
scTask.addQuery('request_item', current.sys_id);
scTask.query();
if (scTask.hasNext()) {
gs.addErrorMessage('RITM cannot be closed until any tasks are open');
current.state = previous.state;
}
})(current, previous);

 

If my video/content helped you in any way, please mark this video/content as BOOKMARK, SUBSCRIBE & HELPFUL

 

Best Regards,

Prashant Kumar (LearnIT)

 

YouTube Channel LearnIT: https://www.youtube.com/@learnitwithprashant

Blog LearnIT: https://medium.com/@LearnITbyPrashant

Prashant Kumar LinkedIn: https://www.linkedin.com/in/learnitbyprashant/

ServiceNow Community Prashant Kumar - https://www.servicenow.com/community/user/viewprofilepage/user-id/19635