Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Wait for condition is not working

keshav77
Tera Contributor

Hi all,

my wait for condition is not working in work flow if I am applying on import set table.

below is the script

 

// Set the variable 'answer' to true or false to indicate if the condition has been met or not.

var importvalue = new GlideRecord('sys_import_set');
importvalue.addQuery('sys_id',workflow.scratchpad.importsetsysid);
importvalue.addQuery('state','processed');
importvalue.query();
if(importvalue.next()){
    gs.info(importvalue.state+"testing for new value");
answer = true;
}
1 REPLY 1

palanikumar
Giga Sage
Giga Sage

Hi,

Did you check whether the code reach inside the if condition? 

Please print the value of workflow.scratchpad.importsetsysid and ensure it has the sys_id. Sometime you need to call toString() function to make it work. So, if you feel it has the correct sys_id then replace the line

importvalue.addQuery('sys_id',workflow.scratchpad.importsetsysid.toString());

 

Thank you,
Palani