Is there a way to dynamically call a microflow

0
I would like to be able to call a microflow based on a list value selected during a loop iteration on a list in a microflow or from a variable passed into the microflow. Is this possible? I have searched the forum and other resources and cannot find a mechanism for doing this. Is it something that can be done in a Java action? If so, is there an example? Thanks
asked
3 answers
3

Here i am showing how to call a microflow inside a loop based on a condition

answered
2

Matthew,

Look in Community Commons, there are a number of microflow execution Java actions. Just be sure the pass in the fully qualified string name of your microflow, including the module name, for example if you wanted to execute a microflow called UpdateBatchReportTables in a module called Analytics, you would call the Java action with the string 'Analytics.UpdateBatchReportTables' as the first argument. I've included a screen shot of one of these Java actions below:

alt text

Mike

answered
0

Hi Matthew,

There are great answers provided by Mike and Machikanti but I would like to offer yet another possibility, by using the Process Queuehttps://appstore.home.mendix.com/link/app/393/Mendix/Process-Queue

 

The advantages of using the ProcessQueue are the following:

  • If your application crashes while executing the scheduled microflow, it will be re-run automatically when the application is restarted.
  • You can specify exactly how many threads you want to dedicate to the Queue (by allowing only 1 thread, you ensure that no concurrent executions will happen. Note that, the same Queue can be shared between several microflows so this is not the same as the Mendix prevent concurrent execution property which only applies to 1 single microflow)
  • Instead of referencing the microflow by its name in your code you can (and should) give it a friendlier name to the Process.
    ‚Äč          This makes the code less prone to typing errors. Also if you (or a collegue) forget that you are calling the microflow by name and rename it in mendix you and you are using the Process Qeueue you will see the error immediatly when you start the application. Otherwise, you will only see the error when you actually invoke the microflow. 
     

I am not suggesting the Process Queue is better in every situation but if you find that some of the points above are important to you than I highly recommend it.

-Andrej

answered