Business rule for RITM

Joyce W
Giga Expert

I am new to scripting.

I want to have a business rule that  prevents Requested Item record from closing if Catalog task is NOT in closed complete state

Thank you kindly, 

 

1 ACCEPTED SOLUTION

try this

var gr = new GlideRecord('sc_task');
gr.addQuery('requested_item', current.sys_id);
gr.addEncodeQuery('state=1^ORstate=2');

gr.addActiveQuery();
gr.query();
if (gr.next())
{
gs.addErrorMessage('There are open task records for this requested item. Please close all tasks.');
current.setAbortAction(true);
}

View solution in original post

15 REPLIES 15

Prateek kumar
Mega Sage

Not every catalog tasks generated out of an RITM needs to be set to Closed Complete, Few may be set to Closed Incomplete or Cancelled.

What should happen then.

I would consider creating the restricting business rule only when the tasks are open or work in progress state.


Please mark my response as correct and helpful if it helped solved your question.
-Thanks