Error message on request item when user closes the request item record without closing the sctasks

maheshch18
Tera Contributor

Error message on a request item when the user closes the request item record without closing the catalog tasks.

2 REPLIES 2

shivangi k
Kilo Sage

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

Rohit01998
Tera Guru

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,