Pause software task until the hardware task's RITM gets complete

Sounderrajan K
Tera Contributor

I have order guide which includes both hardware and software request item.I have requirement that need to hold the software request sctask generation until the hardware request item completes.I need to write a wait for condition in software request workflow and I need to check 5 hardware item and then check the hardware request item state is close if it is true then trigger software task.However the wait for condition is not re-evaluating.

 

Wait for condition script:

var hardwareItems = gs.getProperty('onboarding.og.hardware.catalogitems', '');//list of hardware item Sys ID used in Order Guide
var reqItem = new GlideRecord("sc_req_item");
reqItem.addQuery('request', current.request);
reqItem.addQuery('sys_id', '!=', current.sys_id);
reqItem.addQuery('cat_item.sys_id', 'IN', hardwareItems);
reqItem.query();
if (reqItem.next()) {
    if (reqItem.state == '3') {//hardware task RITM close complete
        answer = true;
    } else {
        answer = false;
    }
}
2 REPLIES 2

Hanna_G
Kilo Sage

Hi @Sounderrajan K 

This is expected behaviour in Workflow - there is nothing to trigger the wakeup of the software item. 

The best approach I could think of is to create an event (through a business rule) when the hardware ritm is completed and then use that event to trigger the software item to carry on. 

Mark Manders
Mega Patron

Move away from Workflow and use the flow designer. Just add a wait on the completion of the HW task and proceed. No needs for scripts.


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark