The CreatorCon Call for Content is officially open! Get started here.

Wait-for-condition activity information.

Eswar13
Tera Contributor

A requested item table workflow, wait-for-condition activity using script to check condition is working fine for the sysapproval_approver table after doing any changes. The same is not working with change_request table. I want to understand any restrictions or limitations or any alternative approach of change request with respect to wait-for-condition activity.

 

For your information, I am using script in condition.

 

Thanks in advance for your help!!

2 REPLIES 2

prasanna11
Giga Guru

Can you provide the script that you are using.? 

Eswar13
Tera Contributor

Creation of change request record using script in previous activity of wait-for condition:

var gr1 = new GlideRecord('change_request');
gr1.initialize();
gr1.requested_by = current.requested_for;
gr1.chg_model = '007c4001c343101035ae3f52c1d3aeb2';
gr1.type = 'normal';
gr1.state = -4;
gr1.assignment_group = 'b85d44954a3623120004689b2d5dd60a';
gr1.short_description = 'Automated Patching - Request for automated Windows patching on cloud';
gr1.insert();
workflow.scratchpad.sysID = gr1.sys_id;


Wait-for condition script:

var sys_id = workflow.scratchpad.sysID;
var gr = new GlideRecord('change_request');
gr.addQuery('sys_id', sys_id);
gr.addQuery('state', '-3');
gr.query();
if (gr.next()) {
answer = true;
}


Thank you for your reply!!