We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

wait for condition

chandan2212
Tera Contributor

Hi All, 

 

I am writing the script in the sc_request workflow (wait for condition) that  untill the all the RITM is not approved the REQ show requeste but below script is not working in the wait for condition.

answer = (function () {
    if (!current || !current.sys_id) return false;
    var reqId = current.sys_id.toString();

 

    // 1) If any child is still waiting for approval 
    var waiting = new GlideRecord('sc_req_item');
    waiting.addQuery('request', reqId);
    waiting.addQuery('approval', 'requested');
    waiting.setLimit(1);
    waiting.query();
    if (waiting.next()) return false;

}

 

 

Can you guide me to resolve the issue.

0 REPLIES 0