ATF Custom step error

Khalid9030
Tera Contributor

Hi All,

 

We have ATF as attached(PFA:ATF_Steps_01) in that we have created the custom step Wait N Seconds as attached (PFA:InputN_02 & WaitseCode_03). Getting below attached error(Error_04)

 

when I give 120 seconds in Wait for N seconds step it is waiting for the response till 120 seconds. In some cases, the response is coming from the previous step that is Scheduled Script Execution is less than 120 seconds like for example 50 sec. in that situation I don't want to wait for 120 seconds it will run immediately once the response is received from the previous step (Scheduled Script Execution) and corresponding next step should be run. It is work like a timeout field in other steps.

 

Code in Wait N Seconds custom step as follows:

 

 

 

(function executeStep(inputs, outputs, stepResult, timeout) {

     // var inputSeconds = 950;

    var seconds = parseInt(inputs.u_seconds2, 10) * 1000;

    var start = new Date().getTime() +seconds ;

    var incidentFound = false;

    do {

        var gr = new GlideRecord('incident');

        gr.addQuery('active', true);

        gr.addQuery('short_description', 'test1');

        gr.query();

        if (gr.hasNext()) {

            // Incident in "In Progress" state found

            incidentFound = true;

            break;

        }

       

    } while (new Date().getTime() < start);

     if (recordFound) {

        stepResult.setOutputMessage('Found record with execution_status 75% and status execute: ' + recordFound);

    } else {

        stepResult.setOutputMessage('No record found with execution_status 75% and status execute within the timeout period.');

    }

    return incidentFound;

 

}(inputs, outputs, stepResult, timeout));

 

 

Note : when I use this same code in Run Server side script step it is working as expected but our client wants to configure this in step configurations.

 

Please  help me to resolve this issue.

0 REPLIES 0