Scenario Overview

In this business scenario we needed to provide a way for a user to generate inspection tasks for each product unit being ordered. The requirement was to execute a workflow from an Order and have it look at all the line item rows one by one. Then for each row look at the quantity field & use its value to create task records which would be to inspect the goods before they shipped.

Other requirements included,

  • Having 10 days to complete the task
  • Having the priority set to high
  • Setting the owner of the Task to a team called 'InspectionTeam'

Example of how an order looks after the Workflow executes. You can see we have 2 line items with a quantity total of 5 so therefore 5 Inspection tasks have been created.

North52 Decision Suite Solution

The North52 Decision Suite solution works like this,

  • A formula of type 'Process Genie' is created so it can execute as a step within a workflow
  • When it reaches the 'Process Genie' step in the workflow it will execute the formula
  • The formula retrieves all the line items for the Order
  • It then loops over the line items where for each quantity it creates the appropriate set of tasks


North52 Decision Suite Steps

The following set of steps outline how to create this Formula

  • Create a new formula of type 'Process Genie'
  • Set the Source Entity to 'Order '
  • Copy & paste the formula below into the formula 
  • Click save & test

Workflow Steps

The following set of steps outline how to create this Formula

  • Create a new workflow named 'Generate Sales Order Inspection Tasks' on the Order entity
  • Set it to run only 'On Demand'
  • Add a new step to the workflow to call the North52 Process Genie
  • Set the formula shortcode to be the one on the formula you just created, in this case 'zJS'
  • Publish the workflow
  • You are now ready to test





   FindRecords('salesorderdetail', 'salesorderid', [salesorder.salesorderid], '*'), 

   DoLoop( CDecimalToInt32(CurrentRecord('quantity')), 

                                        SetAttributeLookup('ownerid', 'team', FindValue('team', 
                                                            'Inspection for: ' + 
                                              SetAttribute('prioritycode', '2'),
                                              SetAttribute('scheduledend', AddDays(UtcDateTime(), 10))

Wizard - FindRecords

Please see below the wizard you can use to create the FindRecords() function call used in this formula. 

Note 1 : To find the value for Equals Value, you will need to go to the Source tab > Order 

Did you know?

TestShield automated tests for Dynamics 365 are easily exported/imported

TestShield uses standard Dynamics 365 solutions to package up your configured tests for easy transport and deployment to other Dynamics 365 instances.

This enables use in automated Azure DevOps pipelines where you can automate the build of a Dynamics instance and apply the TestShield solution to execute your tests. 

It also allows you to put your automated tests into source control alongside other customizations.

Learn more about TestShield