Create a fulfillment provider

Completed

This unit describes the steps that are required for creating a fulfillment provider in Intelligent Order Management.

Create a new provider definition

To create a new provider definition, follow these steps:

  1. Go to Providers > Catalog.
  2. Select New Provider Definition.
  3. For Display Name, enter LabFulfillmentProvider.
  4. For Logical Name, enter msdyn_LabFulfillmentProvider.
  5. For Description, enter lab fulfillment provider.
  6. For Logo, select Lab.png.
  7. For Service Type, enter Fulfillment.
  8. Select Save and close.

Add a provider definition to the solution

To add a provider definition to the solution, follow these steps:

  1. Go to Power Apps maker portal and go to the newly created LabProviders solution.
  2. Select Add existing > IOM Provider Definition.
  3. Select LabFulfillmentProvider and then select Add to add it to the solution.

Create a provider action to send a fulfillment payload to Outlook

To create a provider action to send a fulfillment payload to Outlook, follow these steps:

  1. Go to Power Apps maker portal and go to Solutions.

  2. Open the Default Solution.

  3. Select New.

  4. Select Cloud Flow and then name it Lab Send To Fulfillment (Outlook).

  5. Select the trigger type as Manually trigger a flow and then complete these actions:

    • Select Add an input, select Text, and then enter ProviderActionExecutionEventId in the first field.
    • Select Add an input, select Text, and then enter EntityRecordId in the first field.

    Screenshot of the Manually trigger a flow properties page.

  6. Create a variable initialization action:

    • For Name, enter ExecutionResult.
    • For Type, select Boolean.
    • For Value, enter true.
  7. Create a second variable initialization action:

    • For Name, enter ProcessedSaleOrderLines.
    • For Type, select Array.
  8. Create a third variable initialization action:

    • For Name, enter ProcessedFulfillmentOrderLines.
    • For Type, select Array.

    Screenshot of Variable initialization actions options.

  9. Add a Try scope.

  10. Within the Try scope, add Perform an unbound action by providing the following information:

    • ProviderActionExecutionEventId - Under Dynamic content, select ProviderActionExecutionEventId.
    • PowerAutomateRunId - Specify the expression as: workflow()['run']?['name'].

    Screenshot of the Try scope page.

  11. Add a Get a row by ID action and then enter the following information:

    • For Table name, enter Fulfillment Orders.
    • For Row ID, select EntityRecordId under Dynamic content.

    Screenshot of the Row ID action field in the Try page.

  12. Add a Send an email action from the Outlook.com connector because that's the connection that you previously set up.

    • On the To line, placeholder@placeholder.com is used as placeholder text. You'll replace this placeholder text with a provider parameter in later steps.
    • On the Subject line, you can obtain name from the Get fulfillment order step under Dynamic content.
    • For Body, specify the following expression: outputs('Get_fulfillment_order')['body']

    Screenshot of the Send an email action page.

  13. Add a List rows action as follows:

    • For Table name, enter Fulfillment Order Products.
    • For Fetch Xml query, enter the following code:
    <fetch>  
      <entity name="msdyn_fulfillmentorderdetail">  
       <all-attributes />
          <filter>
         <condition attribute="msdyn_fulfillmentid" operator="eq" value="@{triggerBody()['text_1']}"/>
         </filter>
      </entity>  
    </fetch>
    

    Screenshot of the Get fulfillment order lines page.

  14. Add an Apply to each control with a Send an email action as follows:

    • Obtain value from the Get fulfillment order line step under Dynamic content.
    • Obtain name from the Get fulfillment order line step under Dynamic content.
    • Select Current item from under Dynamic content.

    Screenshot of the Apply to each control page.

  15. Within the loop, add an Append to array variable action as follows:

    • For Name, enter ProcessedFulfillmentOrderLines.
    • For Value, select Fulfillment line ID from under Dynamic content.

    Screenshot of the Append to processed fulfillment lines page.

  16. Within the loop, add another Append to array variable action as follows:

    • For Name, enter ProcessedSalesOrderLines.
    • For Value, select Sales line ID from under Dynamic content.

    Screenshot of the Append to processed order lines page.

  17. Collapse the Try scope by selecting its title bar.

  18. Select New step and then add another scope named Catch.

  19. On the Catch scope, select the ellipsis (...), select Configure run after, and then complete the following setup actions:

    • Select the has failed checkbox.
    • Select the has timed out checkbox.

    Screenshot of the Catch scope page.)

  20. In the Catch scope, select Add an action. Add a Set variable action and then rename it to Set the execution result to failed.

  21. Set up the properties as follows:

    • For Name, enter ExecutionResult.
    • For Value, enter false.

    Screenshot of the Set the execution result to failed page.

  22. Select New step and then add another scope named Finally.

  23. On the Finally scope, select the ellipsis (...), select Configure run after, and then complete the following actions:

    • Select the is successful checkbox.
    • Select the has timed out checkbox.
    • Select the is skipped checkbox.
    • Select the has timed out checkbox.

    Screenshot of the Finally scope page.)

  24. On the Finally scope page, add a condition step and then compare the ExecutionResult variable to true as follows:

    • In the first field, select the ExecutionResult variable.
    • In the second field, select is equal to.
    • In the third field, select true.

    Screenshot of the Condition step showing the three fields.

  25. In the If yes branch, add a Run a child flow action and then rename it to Raise Business Events for processed fulfillment order lines.

  26. Set up the properties as follows:

    • For Child flow, enter Raise Business Event.
    • For BusinessEventDefinitionId, enter 063d85c8-60a4-eb11-9443-000d3a313675.
    • For EntityRecordId, specify the following expression: string(variables('ProcessedFulfillmentOrderLines'))

    Screenshot of the Raise Business Events for processed fulfillment order lines page with the Run child flow action (business events).

  27. In the If yes branch, add another Run a child flow action and then rename it to Raise Sales Order Aggregated Events.

  28. Set up the properties as follows:

    • For LineBusinessEventDefinitionId, enter ccf64002-61a4-eb11-9443-000d3a313675.
    • For LineRecordId, specify the expression as: string(variables('ProcessedSalesOrderLines'))
    • For OrderBusinessEventDefinitionId, enter 48688716-61a4-eb11-9443-000d3a313675.

    Screenshot of the Run child flow action (aggregated events).

  29. Collapse the condition step.

  30. Add Perform an unbound action by following these steps:

    • For Action name, enter msdyn_CompleteProviderActionExecution.
    • For ExecutionResult, select the ExecutionResult variable from under Dynamic content.
    • For ProviderActionExecutionEventId, select ProviderActionExecutionEventId from under Dynamic content.

    Screenshot of the Perform unbound action.)

  31. Select Save.

Add a provider definition logic definition to the Outlook provider definition

To add a provider definition logic definition to the Outlook provider definition, follow these steps:

  1. Go to Providers > Catalog.
  2. Select the newly created LabFulfillmentProvider.
  3. Select Edit on the menu bar.
  4. Select the Logic definitions tab.
  5. Select + New IOM Provider Definition Logic Definition.
  6. For Display Name, enter Lab Send to Fulfillment (Outlook).
  7. For Logical Name, enter msdyn_LabSentToFulfillmentOutlook.
  8. For Provider Definition, enter LabFulfillmentProvider.
  9. For Logic Type, enter Provider Action.
  10. For Workflow Name, enter Lab Send to Fulfillment (Outlook).
  11. For Timeout Minutes, enter 2.
  12. For Max Retry Attempts, enter 3.
  13. For Description, enter Lab Send to Fulfillment (Outlook).
  14. For Action Type, enter Send to Fulfillment.
  15. Select Save. This action will generate a JSON representation of the message handler cloud flow and will populate the Client Data field.
  16. Replace the placeholder email with a provider parameter by copying the text block in the Client Data field and then pasting it into Notepad.
  17. In the text block, find placeholder@placeholder.com and replace it with {{LabOutboundFulfillmentEmail}}.
  18. Copy the modified text block back into the Client Data field.
  19. Select Save and close.
  20. Select Connections. The Microsoft Dataverse and Outlook.com connection reference definitions should now be listed.

Add a provider definition logic definition to the Outlook LabProviders solution

To add a provider definition logic definition to the Outlook LabProviders solution, follow these steps:

  1. Go to Power Apps maker portal and go to the newly created LabProviders solution.
  2. Select Add existing > IOM Provider Definition Logic Definition.
  3. Select Lab Send To Fulfillment (Outlook) and then select Add to add it to the solution.

Add provider definition connection references to the LabProviders solution

To add provider definition connection references to the LabProviders solution, follow these steps:

  1. Go to Power Apps maker portal and go to the newly created LabProviders solution.
  2. Select Add existing > IOM Provider Definition Connection Reference.
  3. Select the Microsoft Dataverse and Outlook.com provider definition connection references and then select Add to add them to the solution.

Create a provider action to send a fulfillment payload to RequestBin

To create a provider action to send a fulfillment payload to RequestBin, follow these steps:

  1. Go to Power Apps maker portal and go to Solutions.

  2. Open the Default Solution.

  3. Select New.

  4. Select Cloud Flow and then name it Lab Send To Fulfillment (RequestBin).

  5. Select the trigger type as Manually trigger a flow and then enter the following information:

    • Select Add an input, select Text, and then enter ProviderActionExecutionEventId in the first field.
    • Select Add an input, select Text, and then enter EntityRecordId in the first field.

    Screenshot of how to manually trigger a flow properties (RequestBin).

  6. Create a variable initialization action:

    • For Name, enter ExecutionResult.
    • For Type, select Boolean.
    • For Value, enter true.
  7. Create a second variable initialization action:

    • For Name, enter ProcessedSaleOrderLines.
    • For Type, select Array.
  8. Create a third variable initialization action:

    • For Name, enter ProcessedFulfillmentOrderLines.
    • For Type, select Array.

    Screenshot of variable initialization actions (RequestBin).

  9. Add a Try scope.

  10. Within the Try scope, add Perform an unbound action as follows:

    • ProviderActionExecutionEventId - Under Dynamic content, select ProviderActionExecutionEventId.
    • PowerAutomateRunId - Specify the expression as: workflow()['run']?['name']

    Screenshot of the Try scope (RequestBin).

  11. Add a Get a row by ID action and set up the action as follows:

    • For Table name, enter Fulfillment Orders.
    • For Row ID, select EntityRecordId under Dynamic content.

    Screenshot of the Get a row ID action (RequestBin).

  12. Add a Create fulfillment order action from the RequestBin connector by selecting body from under Dynamic content for the Body.

    Screenshot of the Create fulfillment order action.

  13. Add a List rows action as follows:

    • For Table name, enter Fulfillment Order Products.
    • For Fetch Xml query, enter the following:
    <fetch>  
      <entity name="msdyn_fulfillmentorderdetail">  
       <all-attributes />
          <filter>
         <condition attribute="msdyn_fulfillmentid" operator="eq" value="@{triggerBody()['text_1']}"/>
         </filter>
      </entity>  
    </fetch>
    

    Screenshot of the List rows action.

  14. Add an Apply to each control with a Create fulfillment order lines action from the RequestBin connection as follows:

    • Obtain value from the Get fulfillment order line step under Dynamic content.
    • Select Current item from under Dynamic content.

    Screenshot of the Apply to each control (Requestbin).

  15. Within the loop, add an Append to array variable action as follows:

    • For Name, enter ProcessedFulfillmentOrderLines.
    • For Value, select Fulfillment line ID from under Dynamic content.

    Screenshot of the Append to array action (fulfillment).

  16. Within the loop, add another Append to array variable action as follows:

    • For Name, enter ProcessedSalesOrderLines.
    • For Value, select Sales line ID from under Dynamic content.

    Screenshot of the Append to array action (sales).

  17. Collapse the Try scope by selecting its title bar.

  18. Select New step and then add another scope renamed to Catch.

  19. On the Catch scope, select the ellipsis (...), select Configure run after, and then follow these steps:

    • Select the has failed checkbox.
    • Select the has timed out checkbox.

    Screenshot of the Catch scope page.

  20. In the Catch scope page, select Add an action, add a Set variable action, and then rename it to Set the execution result to failed.

  21. Set up the properties as follows:

    • For Name, enter ExecutionResult.
    • For Value, enter false.

    Screenshot of the Set variable.

  22. Select New step and then add another scope renamed Finally.

  23. In the Finally scope, select the ellipsis (...), select Configure run after, and then follow these steps:

    • Select the is successful checkbox.
    • Select the has timed out checkbox.
    • Select the is skipped checkbox.
    • Select the has timed out checkbox.

    Screenshot of the Finally scope page.)

  24. In the Finally scope, add a condition step and then compare the ExecutionResult variable to true as follows:

    • In the first field, select the ExecutionResult variable.
    • In the second field, select is equal to.
    • In the third field, select true.

    Screenshot of the Condition step.

  25. In the If yes branch, add a Run a child flow action and rename it to Raise Business Events for processed fulfillment order lines.

  26. Set up the properties as follows:

    • For Child flow, enter Raise Business Event.
    • For BusinessEventDefinitionId, enter 063d85c8-60a4-eb11-9443-000d3a313675.
    • For EntityRecordId, specify the following expression: string(variables('ProcessedFulfillmentOrderLines'))
  27. In the If yes branch, add another Run a child flow action and rename it Raise Sales Order Aggregated Events.

  28. Set up the properties as follows:

    • For LineBusinessEventDefinitionId, enter ccf64002-61a4-eb11-9443-000d3a313675.
    • For LineRecordId, specify the following expression: string(variables('ProcessedSalesOrderLines')).
    • For OrderBusinessEventDefinitionId, enter 48688716-61a4-eb11-9443-000d3a313675.

    Screenshot of the Run child flow action (aggregated events).

  29. Collapse the condition step.

  30. Add Perform an unbound action as follows:

    • For Action name, enter msdyn_CompleteProviderActionExecution.
    • For ExecutionResult, select the ExecutionResult variable from under Dynamic content.
    • For ProviderActionExecutionEventId, select ProviderActionExecutionEventId from under Dynamic content.

    Screenshot of the Perform unbound action.

  31. Select Save.

Add a provider definition logic definition to the provider definition (RequestBin)

To add a provider definition logic definition to the RequestBin provider definition, follow these steps:

  1. Go to Providers > Catalog.
  2. Select the newly created LabFulfillmentProvider.
  3. Select Edit on the menu bar.
  4. Select the Logic definitions tab.
  5. Select + New IOM Provider Definition Logic Definition.
  6. For Display Name, enter Lab Send to Fulfillment (RequestBin).
  7. For Logical Name, enter msdyn_LabSentToFulfillmentRequestBin.
  8. For Provider Definition, enter LabFulfillmentProvider.
  9. For Logic Type, enter Provider Action.
  10. For Workflow Name, enter Lab Send to Fulfillment (RequestBin).
  11. For Timeout Minutes, enter 2.
  12. For Max Retry Attempts, enter 3.
  13. For Description, enter Lab Send to Fulfillment (RequestBin).
  14. For Action Type, enter Send to Fulfillment.
  15. Select Save. This action will generate a JSON representation of the message handler cloud flow and will populate the Client Data field.
  16. Select Save and close.
  17. Select Connections. The Microsoft Dataverse, Outlook.com, and RequestBin connection reference definitions should be listed.

Add a provider definition parameter to the provider definition

To add a provider definition parameter to the provider definition, follow these steps:

  1. Select Parameters.
  2. Select + New IOM Provider Definition Parameter.
  3. For Display Name, enter LabOutboundFulfillmentEmail.
  4. For Data Type, enter Text.
  5. For Provider Definition, enter LabFulfillmentProvider.
  6. For Key, enter LabOutboundFulfillmentEmail.
  7. For Logical Name, enter msdyn_LabOutboundFulfillmentEmail.
  8. For Is Required, enter Yes.
  9. Select Save and close.

Add a provider definition logic definition to the LabProviders solution (RequestBin)

To add a provider definition logic definition to the RequestBin LabProviders solution, follow these steps:

  1. Go to Power Apps maker portal and go to the newly created LabProviders solution.
  2. Select Add existing > IOM Provider Definition Logic Definition.
  3. Select Lab Send To Fulfillment (RequestBin) and then select Add to add it to the solution.

Add a provider definition connection reference to the LabProviders solution

To add a provider definition connection reference to the LabProviders solution, follow these steps:

  1. Go to Power Apps maker portal and go to the newly created LabProviders solution.
  2. Select Add existing > IOM Provider Definition Connection Reference.
  3. Select RequestBin and then select Add to add it to the solution.

Add a provider definition parameter to the LabProviders solution

To add a provider definition parameter to the LabProviders solution, follow these steps:

  1. Go to Power Apps maker portal and go to the newly created LabProviders solution.
  2. Select Add existing > IOM Provider Definition Parameter.
  3. Select LabOutboundFulfillmentEmail and then select Add to add it to the solution.