Register and use a custom workflow activity assembly

 

Applies To: Dynamics 365 (online), Dynamics 365 (on-premises), Dynamics CRM 2016, Dynamics CRM Online

After you compile your custom workflow activity to create an assembly, you have to register the assembly with Microsoft Dynamics 365. Your custom activity then appears in the process form of Microsoft Dynamics 365 (online) or Microsoft Dynamics 365 depending on which deployment you registered the custom workflow activity with.

In This Topic

Enable or disable custom code

Register a custom workflow activity

Use a custom workflow activity in a process

Enable or disable custom code

You can use Windows PowerShell to enable or disable custom workflow activities and plug-in execution for an on-premises server as described here. Alternatively, you can use the Deployment web service. For more information, see Deployment entities and deployment configuration settings to learn how to set the CustomCodeSettings.AllowExternalCode property.

To enable custom code

  1. Open a Windows PowerShell command window.

  2. Add the Microsoft Dynamics 365 PowerShell snap-in:

    Add-PSSnapin Microsoft.Crm.PowerShell
    
  3. Retrieve the current setting:

    $setting = get-crmsetting customcodesettings
    
  4. Modify the current setting:

    $setting.AllowExternalCode="True"
    
    set-crmsetting $setting
    
  5. Verify the setting:

    get-crmsetting customcodesettings
    

To disable custom code

  1. Open a Windows PowerShell command window.

  2. Add the Microsoft Dynamics 365 PowerShell snap-in:

    Add-PSSnapin Microsoft.Crm.PowerShell
    
  3. Retrieve the current setting:

    $setting = get-crmsetting customcodesettings
    
  4. Modify the current setting:

    $setting.AllowExternalCode=0
    
    set-crmsetting $setting
    
  5. Verify the setting:

    get-crmsetting customcodesettings
    

Register a custom workflow activity

Custom workflow activity assemblies are registered using the Plug-in Registration tool. The tool provides a graphical user interface and supports registering assemblies that contain plug-ins or custom workflow activities. When registering an assembly that contains custom workflow activities with Microsoft Dynamics 365 (online), you must register the assembly in the sandbox (partial trust).

For more information about how to register and deploy a custom activity assembly by using the tool, see Specify the name and group name for a custom workflow activity.

Note

You can find the Plug-in Registration tool’s executable file in the SDK\Tools\PluginRegistration folder of the SDK. Download the Microsoft Dynamics CRM SDK package. The tool can be added to the Microsoft Visual Studio Tools menu as an external tool to speed up the development process.

Use a custom workflow activity in a process

After you have registered your custom workflow activity assembly, you can use it in the process designer in Microsoft Dynamics 365.

To use your custom workflow activity in a process:

  1. Sign in to Microsoft Dynamics 365.

  2. Go to Settings > Processes.

  3. Create or open an existing process.

  4. In the process designer, click or tap Add Step. Your custom workflow activity name will appear in the drop-down list.

See Also

Custom workflow activities (workflow assemblies)
Debug a custom workflow activity
Plug-in isolation, trusts, and statistics
Register and Deploy Plug-Ins

Microsoft Dynamics 365

© 2016 Microsoft. All rights reserved. Copyright