Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Set RITM to Work in Progress

Rocky5
Kilo Sage

Hello Experts,

I wanted to set RITM state to "Work in Progress" when any catalog task state of that RITM is set to "Work in progress", I have written the below script "after" update BR on Sc_Task table, It works as expected but some Random blank RITMs are getting created. Assuming that is because sc_task doesn't have request_item as soon as gr.update(); happens on the empty gliderecord it is inserting the new record.

Is my assumption correct? if so, what is other alternative to achive this requirement.

After update BR on sc_task table:

(function executeRule(current, previous /*null when async*/ ) {

    var gr = new GlideRecord('sc_req_item');
    gr.get(current.getValue('request_item'));
    gr.state = 2;
    gr.update();

})(current, previous);

Thanks,

Rocky.

 

6 REPLIES 6

Hi,

I tried but no luck. 

Thanks,

Rocky.

What is the "When to Run" conditions you are using?