wait for condition in flow designer

Kalyani35
Tera Guru

Hi experts,

I am using flow designer , in which I need to wait until all the existing response tasks are completed and then move further.

I am using wait for condition action in flow designer ad have written a script for it. But when I check flow execution it shows an error- java.lang.Boolean cannot be cast to java.lang.String

find_real_file.png

This is how the flow looks like currently.

find_real_file.png

script in wait for condition is -

var cnt_task;

var parent_sys_id= fd_data.trigger.current.sys_id;
gs.info('start flow parent_sys_id: '+parent_sys_id)
var gr= new GlideRecord('sn_si_task');
gr.addQuery('parent',parent_sys_id);
gr.addQuery('state','NOT IN','3,4,7');
gr.query();
cnt_task=gr.getRowCount();
if(cnt_task==0)
{
gs.info("inside if cnt: "+cnt_task);
return true;
}
else
{
gs.info("inside else cnt: "+cnt_task);
return false;
}
Thanks in advance!
1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

As suggested by Muhammad you will have to change the logic.

You will have to write after update BR on sn_si_task table and mimic an update on sn_si_incident so that flow proceeds once wait for condition evaluates to true

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

8 REPLIES 8

hammad ul aziz2
Mega Guru

this means there is a parameter that needs to be string and you are providing it as object, please make sure all the parameters that you are providing in your script for GlideRecord addQuery must be in string format.
try adding .toString(); after the sys_ids that you providing.

let me know if the problem still persists.

please mark this as helpful or correct if this solves your problem.

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

As suggested by Muhammad you will have to change the logic.

You will have to write after update BR on sn_si_task table and mimic an update on sn_si_incident so that flow proceeds once wait for condition evaluates to true

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi Ankur,

Do you mean that I need to create a field on sn_si_incident table to validate if there are any pending tasks and instead of checking it on sn_si_task table (through script in flow).

Can you please elaborate bit more.

Thanks!

Hi,

Yes somewhat like that.

But I would suggest to use after update BR on "sn_si_task" table and after closure of SI Task do your processing on "sn_si_incident" parent record

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader