How to call workflow for multiple records?

0
I'm facing an issue where the Call Workflow button that I've dragged and dropped into Data Grid 2 is not clickable on the user side. There's no error message being thrown either, so I'm unsure what's causing this. Is there a specific reason why this might be happening? Also, if I want to trigger a workflow for multiple records at once, how can I achieve that in Mendix?  
asked
1 answers
0

Hi Zia,

 

I assume your workflow expects a parameter of Employee as workflow context?

Data grid 2 has selection set to none by default. The way you have it set up now, it probably needs a row of the datagrid to be selected before you are able to click the workflow button because you need to determine which Employee object you want to pass into the Workflow.

You can either use a checkbox or row click to select the object.

image.png

 

 

You can also add an extra column to the datagrid with custom content, in this custom content column you can put a button with the call workflow functionality.

image.png

image.png

 

 

If you want to be able to trigger the workflow for multiple employees at once I would suggest the following:

Instead of directly triggering the call workflow button in the data grid 2, you can build a custom microflow that takes a list as input parameter, loops over this list, and for each of the employees in the list trigger your workflow. 

 

You do however have to think about what happens after you trigger the workflow. For example: are you going to show a workflow task page to the end user or is the workflow going to do some processing in the background?

- If you are going to show a page, I think triggering multiple workflows at once is not what you want to happen, as triggering the workflow for multiple Employee objects will then result opening multiple pages. You actually want to create some logic where you trigger it for the first item of this list, and only trigger the workflow for the second item in your employee list once the first one is finished. 

- If you are going to do some background processing, directly triggering all workflows by looping over your list could be sufficient. 

 

Hopefully this helps!

answered