Show error message on RITM without close compaleting SC TASKS

ShaziyaS4380655
Tera Contributor

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.

7 REPLIES 7

 

The reason sc_req_item might not appear in the Flow Designer trigger table list is due to some out-of-the-box restrictions. Certain tables, such as sc_req_item, are not available in Flow Designer by default. Additionally, if the table is not within the application scope—like when working in a scoped app—sc_req_item, which is a global table, may not be accessible unless it is explicitly added. It’s also possible that the table hasn’t been included in the Flow Designer table configuration.

 

If you’re unable to trigger directly on sc_req_item, you can set up a Scheduled Flow to run every few minutes. Include a Get Records step for the sc_req_item table with conditions such as state = Closed Complete and validation_flag not equal to true. You can then add logic to review SC Tasks and update or revert the RITM as needed. This approach mimics a reactive flow without requiring a direct trigger.

 

If it is helpful, please hit the thumbs button please mark the answer as correct based on the impact!!

 

Kind Regards,

Shaik Mohammed Mustaq

 

 

Ankur Bawiskar
Tera Patron
Tera Patron

@ShaziyaS4380655 

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! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

updating RITM state thru flow once catalog tasks are close completed and not  allowed to create BR, client scripts on OOTB tables