Create a Plugin or Workflow.

Starting in v4, XrmToolkit provides a new wizard that helps you easily create a custom workflow or plugin.

Create a custom plugin

Invoke the plugin wizard by using the 'Add New Plugin or Workflow' menu item for your plugin assembly project shown here:

  1. Select 'Plugin' to generate the plugin class
  2. This is the name of the plugin
  3. This is the filename and location where the class will be generated.
  4. Optionally choose to create the base plugin class.
    Note:
    The plugin classes generated by XrmToolkit inherit from a base class. You should always select this option if the base class has not been generated yet.
  5. This is the name of the base class that the custom plugin inherits from.
  6. This is the filename and location where the base class will be generated.

After specifying the name of the file and pressing the 'Next' button, the following will appear:

Here you will specify the entity type that you would like to register the plugin for:

You can optionally create an early bound or proxy class for the entity as well. For more information see the documentation here.

Note:
If the option is grayed out then the class has already been generated in the same project.

Specify the name of the step along with the other properties according to your needs. For more information see the Microsoft documentation here.

Intorduced in v4, you can also see steps registered for the same entity and message by clicking on the following:

This is helpful in determining the correct 'Order' for the new plugin by comparing the stage and order of the other plugins. Clicking on the buttom shows the following dialog:

Note:

Items are sorted by stage and order such that they should generally be displayed in the order that they will execute.

Pressing the 'Next' button will show a summary of what will be created:

Pressing the 'Finish' button will create the files in your project and open up the newly created plugin file:

Note:

Notice that the stage, message name and entity name properties have been set for you. Also, if you chose to generate a proxy class, you can update the local plugin context to use this class. This is helpful when referencing any 'Pre' or 'Post' images in the local context.

To modify the plugin, step, or image properties you can select the 'Edit Plugin and Step Configs' menu option shown here:

You can register the assembly and all child configurations by pressing the highlighted button:

Create a custom workflow

Invoke the plugin wizard by using the 'Add New Plugin or Workflow' menu item for your plugin assembly project shown here:

  1. Select 'Workflow' to generate the workflow class
  2. This is the name of the workflow
  3. This is the filename and location where the class will be generated.
  4. Optionally choose to create the base workflow class.
    Note:
    The workflow classes generated by XrmToolkit inherit from a base class. You should always select this option if the base class has not been generated yet.
  5. This is the name of the base class that the custom workflow inherits from.
  6. This is the filename and location where the base class will be generated.

Pressing the 'Next' button will show a summary of what will be created:

Pressing the 'Finish' button will create the files in your project and open up the newly created workflow file:

The highlighted portions of the workflow class are for reference only. You can remove/update per your own requirements.

Workflow Registration:
Registration of a workflow is the same for a workflow as it is for a plugin. You can reference the registration process above or see the documentation here.