Custom Activities

Update your dialogs to use Custom Actions

Introduction


Dialogs for Unified Interface does not currently support running custom workflow activities within your dialogs. These are pieces of functionality implemented by custom code, either developed by your organization or a third party.

Custom actions are another extensibility point in Microsoft Dynamics 365. These also allow you to run custom workflow activities, and are still a supported feature of Microsoft Dynamics 365. They can also be called from a dialog

If you are currently using a custom workflow activity in your dialog, you will need to edit it to use a custom action instead. That custom action can, in turn, use the custom workflow activity. Your dialog users should therefore see no difference in the end result.

Creating a Custom Action


You'll first need to create your new custom action. You can do this within your Power Apps solution, but at the time of writing this is not available within the maker portal - you'll need to switch to the classic solution view first:

  1. Go to the Power Apps maker portal
  2. Ensure you have the correct environment selected in the top menu
  3. Select "Solutions" in the left-hand menu
  4. Select the solution to create your custom action in, or create a new one
  5. In the top menu, click "Switch to Classic"
  6. In the classic solution editor, click "New" and select "Process"
  7. Enter an appropriate process name, e.g. the same name as your custom workflow activity
  8. Under "Category", select "Action"
  9. Under "Entity", select "None (global)"
  10. Click OK

Adding Arguments


Create input and output arguments for your action to mirror those of your custom activity. You'll need some knowledge of the custom activity to get these details. For each argument:

  1. Click the green add button
  2. Enter the name and type of the argument
  3. For lookup arguments, select the type of entity the lookup refers to
  4. Select the appropriate Input or Output direction

Adding the Activity to the Action


At the bottom of the custom action screen you'll see the familiar workflow editing interface.

  1. Add your custom activity to the action "workflow"
  2. Click the "Set Properties" button
  3. Use the Dynamic Values section to set the value of each of the properties of the custom activity to the values from the arguments of the custom action

Updating Output Arguments


If your custom activity has output properties, you'll already have created output arguments of your custom action. We now need to set the values of those output arguments to the values created by the custom activity. For each output argument:

  1. Add an "Assign Value" step to the action
  2. Click the "Set Properties" button
  3. Enter a "Statement Label"
  4. Select the name of the output argument to set the value of
  5. Use the Dynamic Values section to set the value to the value produced by the custom action

Editing the Dialog


Now your custom action is ready, you need to edit your dialog to call that action instead of the custom workflow activity.

  1. Return to the classic solution editor and open your dialog
  2. Deactivate the dialog in order to edit it
  3. Remove the existing custom workflow activity from the dialog
  4. At the same stage of the dialog, add in a new "Perform Action" step
  5. Under "Action", select the custom action you created earlier. The "Entity" setting should change to "None (global)"
  6. If your action has any input arguments, click "Set Properties" and set the values for those arguments in exactly the same way as you did for the custom workflow activity
  7. If your dialog used the values of any output properties generated by your custom workflow activity, you will need to update those steps to use the output arguments of your custom action instead.
  8. Save and activate your dialog