Activity count exceeds max on workflow

pennieturner
Mega Guru

We have a workflow running which has a timer event on to wait for all the catalog tasks to be closed before it continues to the next stage.

The problem we have is that the workflow activity count exceeds 100 when its waiting for a while of the tasks to be closed, and the workflows are automatically cancelled, leaving the RITM in limbo.

I've tried to find out where the max count of 100 is found to see if I can change it, but, I don't seem to be able to find it anywhere.

Can anyone help? or if anyone has any ideas of how to get around this please let me know.   We don't want to raise the timer anymore than it is (every 2 hours).

Hoping someone can help!

Regards

1 ACCEPTED SOLUTION

If you want to change for existing workflow, Go to workflow editor > Checkout your workflow > Go to Properties > There you can change the count.


View solution in original post

19 REPLIES 19

Jason



I'm just looking at using the wait for condition.   I don;t see how I can use it?   The workflow is attached to the requested item.   As part of the workflow, it sets up numerous catalog tasks.



When it gets to the timer, the timer basically waits 2 hours, then an ID statement checks to see if any catalog tasks are still open,if there are, it then goes back to the timer to wait 2 hours before it checks again:



var tasks = new GlideRecord('sc_task');


tasks.addQuery('request_item' ,current.sys_id);


tasks.addActiveQuery();


tasks.query();


if (tasks.next()) {


answer = 'no';


} else {


answer = 'yes';


}



I can't see how the wait for condition would work?   I can add a script into there, but wouldnt this then fire at the first time one of the catalog tasks is closed? Do you have any ideas?


Hi Pennie,



In the 'Wait for condition' activity you have a field named 'condition script'.


Here you can write your code to check for any active tasks and then set answer to true/false.



Use below code in you wait for condition activity -


var tasks = new GlideRecord('sc_task');


tasks.addQuery('request_item' ,current.sys_id);


tasks.addActiveQuery();


tasks.query();


if (tasks.next()) {


answer = false;


} else {


answer = true;


}



This will make your workflow to wait until all the tasks are closed or become inactive and only then move ahead.



Thanks,


Tanaji


Hi



I have tried this, but it doesnt work.   I think its because its a script, there's nothing to say re-run the script to check the tasks are closed, so the workflow is just hanging at the wait for condition.


No it will keep checking/running your script until it passes it. There is no need of manually doing it.


Make sure you are setting true/false to the global answer variable and not 'no'/'yes'.


Can you just copy paste above code and re-try?


Hi, yes I copied your code into the wait for condition:



I have attached the screen shots to show you the workflow at the Wait for Condition, the closed tasks all inactive and the code.



Thank you for your help, its appreciated



Regards