Expand my Community achievements bar.

SOLVED

Implementing a 'Test' flow control to technical Workflow

Avatar

Level 2

Hello all!

I would like to know the best method to go about implementing a Test activity to 4 of my technical workflows.

I currently have 4 different workflows (one for each Newsletter subscription type, health, pets, etc) When they run I sometimes get deadlocks and my workflow fails. I figured if I put a 'Test' activity right after my scheduler to check if any of the other 3 workflows are currently running to try again later would help solve this issue?

is there a way about implementing this? How would l be able to add some sort of variable that can communicate between my technical workflows that it is currently running? I hope I was able to communicate my thought processes clearly?

Thank you!

1 Accepted Solution

Avatar

Correct answer by
Level 7

Hi Edward,

Can you please explain if your workflows have got any dependency on each other?

If not then

  • You can simply use Test activity right after your initial query and check if there are any records or not.
  • Also, you can try scheduling your workflows at a time difference of couple of mins from each other so that they all don't start at the same time

Let me know if this helps or if you can elaborate it more for us to understand your problem better.

Thanks,
Anita

View solution in original post

5 Replies

Avatar

Correct answer by
Level 7

Hi Edward,

Can you please explain if your workflows have got any dependency on each other?

If not then

  • You can simply use Test activity right after your initial query and check if there are any records or not.
  • Also, you can try scheduling your workflows at a time difference of couple of mins from each other so that they all don't start at the same time

Let me know if this helps or if you can elaborate it more for us to understand your problem better.

Thanks,
Anita

Avatar

Community Advisor

Hi Edward,

Try to use

task.wait function before starting your next technical workflow with checking the status of next workflow using queryDef . I

f status is Inprogress then move otherwise alert Error !

Thanks,

Kapil

Avatar

Level 10

Hi Edward,

In addition of  kapscool advice, you can also consider the usual way, well, it is called the semaphores method in IT area (not restricted to AC).

Usually, when AC developers need to not run a same technical workflow if the previous execution is not completed, they use xtk:option records (listed in Administration>Platform>Options) and the API Javascript methods getOption() and setOption() to set the last execution datetime value. And there is a check at the beginning of the workflow to test the last execution date, and comparing to GetDate() so it avoids running twice the same workflow if not finished.

(The same idea is to use an instance variable saved to true at end of worfklow and initially set to false, and test it at the early beginning of the wkf to see if the wkf is running... but last execution datetime is more powerful, see below).

The same method can be used for several workflows: so in your case you would have 4 xtk:options records, with testing 4 values at each wkf start, and setting the getDate() value at the very end of wkfs.

But this last execution date is also useful to take into considerations only date from the last execution date, in order to not treat records already processed.

Regards.
J-Serge

Avatar

Level 2

How would I check to see if there is a record or not using the test activity? I like this idea as I was thinking to myself, not every cycle will have a result. so if there are no results this time 'end' query. but when I select conditions under the test activity not sure what field to use?

Thanks!