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?

We listen to customer feedback!

Although our business rules engine for Dynamics 365 has over 500 functions, sometimes you'll come across a requirement for which we don't provide a specific function for. Let us know the details and our team will be happy to review your requirement or suggestion and either provide a solution from our existing toolset or look to enhance our product to meet your requirements. 

You can make suggestions on our ideas page or email us directly at