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 Close RITM when SCTASK is Closed using Business Rules.

 

 

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

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

// Add your code here
var sct = new GlideRecord('sc_task');
sct.addQuery('request_item', current.request_item);
sct.query();
var totalCount = sct.getRowCount();

var sct1 = new GlideRecord('sc_task');
sct1.addQuery('state', IN, '3,4,7');
sct1.addQuery('request_item', current.request_item);
sct1.query();
var completedtotalcount = sct1.getRowCount();

if (totalCount == completedtotalcount) {
var ritm = current.request_item.getRefRecord();
ritm.state = 3;
ritm.update();
}

})(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

2 Comments