Expand my Community achievements bar.

SOLVED

Can the spawnWithParameters method activate the same workflow twice at the same time?

Avatar

Level 2

Hello everybody, I am currently analyzing a request and all the impacts it could have but before touching anything, I would like to know if the spawnWithParameters or startWithParameters method could execute the same workflow at the same time without it Is there any error?

 

Let me explain, I have several workflows which run at the same time and which finish their processing almost at the same time. At the end of these workflows I would like to use one of two methods to launch a single generic workflow with parameters.

 

I think that startWithParameters is better than spawnWithParameters because the latter risks creating a lot of instances in the long term (unless it is deleted at the end of their processing) Thank you in advance for those who take the time to respond to me

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hello @Ragsthenos,

The 'StartWithParameters' method can only be executed on a workflow being edited or finished.

The 'SpawnWithParameters' can do the trick, but as you said, it'll create lot of instances in the long term.

One good alternative is to use Sub-workflow activity. You can make your generic workflow as a sub-workflow, and use sub-workflow acitvity in other workflows to call it. I've just tested it, variables are passed from main workflow to sub-workflow.

main workflow :

Amine_Abedour_0-1702513637184.png

sub-workflow :

Amine_Abedour_1-1702513690238.png

result in main workflow :

Amine_Abedour_2-1702513745460.png

 

Br,

Amine

 

View solution in original post

4 Replies

Avatar

Correct answer by
Community Advisor

Hello @Ragsthenos,

The 'StartWithParameters' method can only be executed on a workflow being edited or finished.

The 'SpawnWithParameters' can do the trick, but as you said, it'll create lot of instances in the long term.

One good alternative is to use Sub-workflow activity. You can make your generic workflow as a sub-workflow, and use sub-workflow acitvity in other workflows to call it. I've just tested it, variables are passed from main workflow to sub-workflow.

main workflow :

Amine_Abedour_0-1702513637184.png

sub-workflow :

Amine_Abedour_1-1702513690238.png

result in main workflow :

Amine_Abedour_2-1702513745460.png

 

Br,

Amine

 

Avatar

Community Advisor

Hello, @Amine_Abedour  The sub-workflow also creates a new instance on every run.

 

@Ragsthenos 

One of the solution could be to save the data from workflows in Options and then use the generic workflow to read the Options created by the main workflows


     Manoj
     Find me on LinkedIn

Avatar

Community Advisor

Hello @_Manoj_Kumar_ 

 

Indeed, the sub-workflow creates an instance at each execution, but it destroys it immediately after the execution.

 

Br,

Amine 

Avatar

Level 2

Hello @Amine_Abedour,

 

Thank you for your answer, I actually created a sub-workflow yesterday after asking my question and this solution seems to be the most appropriate, the problem is that if the sub-workflow goes into error for one reason or another, the main workflow also fails.

 

It still meets my needs, I'll see what I can do to optimize.