Using flags to invoke workflows

Hey, I need some urgent help. I need to read an excel file that contains a bunch of flags. If flags exists, then it needs to invoke a workflow for each flag in that row. I have to read the row and determine which workflows need to be invoked for that row

For example: if the role is FDRA Analyst with the event type Transaction Related and ATM it should invoke/add those workflows (FCP Reports, Deposite Image, check image…)

You can build a flowchart with a decision tree. Based on the flags, point to the specific Invoke Workflow activity for that workflow. While technically you can have a variable for the Invoke Workflow activity, you would need to make sure the Arguments of all the invoked workflows are the same, so I would not recommend that approach. Instead, just have separate invoke activities for each workflow and build it into your flowchart.

1 Like

Hi @S_N1,

You can try following:

  1. Read excel and save its data as datatable
  2. Loop through that data table
  3. include a flowchart for different routes possible(e.g. FDRA etc)
  4. In that route, create sequence with all invoke workflows
  5. Repeat the steps.

If you don’t wish to use flowcharts, you can also use switch case instead in step 3, however, I would suggest usage of flowchart for better readability and maintainability.


1 Like

Hi S_N1!

Beware of these challenges not to generate too complex code that can generate a lot of support in the future!

A good approach would be to perform a workflow call match on a base file. E.g.: FCP Reports calls WorkflowReports; Deposit Image calls WorkflowDepositeImage

This way you can make a dynamic call! Look:

Note that depending on the ‘TransactionName’ variable a different workflow is called. The logic would be something like, if I have an “X” in this column, I look for which .xaml I call for this column and I call it dynamically. Note that you will only have one workflow call in your entire code and no conditionals!

This is easy to modify and support in the future, as well as providing a compact and clean code.


1 Like