WF hanging at Wait Condition

A_Nelson
Kilo Expert

Hello!

In my Workflow, I am waiting for a change task (created via a create a task activity) to be completed. For some reason the check box "wait for completion" is causing the activity to hang even after the task is completed. I assume this is due to the heavy scripting involved in the activity itself. To try and get around this, I have unchecked the box and made a wait condition with the below script. This too is failing to move forward once the change task is completed. I have verified that the query is working by setting values from the query. Any suggestions on why this is failing? Thanks!

 

var gr = new GlideRecord('change_task');
gr.addQuery('change_request', current.u_change_request); // this matches the change request to the one listed in the RITM
gr.query();
while(gr.next()){
if(gr.state == 3 || gr.state == 4){
answer = true;

}}

5 REPLIES 5

Prateek Gupta3
Mega Guru

Hi,

 

The workflow when initially checks the condition which is not fulfilled, it stucks there.

And after that even if that request is getting closed, workflow does not move. Because it is still stuck at Wait for condition.

Solution is just right a business rule: whenever condition matches, force update the RITM. By doing this Wait for condition is again checked. If it is fulfilled workflow will move ahead.

 

 

 

Thanks,

Prateek

Thank you for the speedy response! I shall try this and will inform you of the results!

I added the below business rule, but it is still not going past the wait condition once the change task is closed.

 

BR:

// Run any workflow(s) so this task's state changes can be checked

(function executeRule(current, previous /*null when async*/) {
// Add your code here
var gr = new GlideRecord("sc_req_item");
gr.addQuery("sys_id",current.request_item.sys_id);
gr.query();
if (gr.next()) {
new Workflow().broadcastEventToCurrentsContexts(gr, 'update', null);
}
})(current, previous);

Hi

 

Please write the below code in business rule on change table. with required condition.

 

var gr = new GlideRecord("sc_req_item");
gr.addQuery("sys_id",current.request_item.sys_id);
gr.query();
if (gr.next())

{

gr.short_description="ANY_TEXT";

gr.update();

}

 

 

I also worked on similar scenario.

 

Thanks,

Prateek