Kentico CMS 7.0 On-line Marketing Guide

Defining custom actions

Defining custom actions

Previous topic Next topic Mail us feedback on this topic!  

Defining custom actions

Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic!  

Kentico CMS enables you to write your own actions to incorporate into an automation process. First, you need to write the action's code and then register it as a new action in automation processes. Note that writing custom actions requires certain programming experience.

 

Writing actions

 

1. Create a new class and make it inherit from CMS.WorkflowEngine.AutomationAction for general automation actions and CMS.OnlineMarketing.ContactAutomationAction for actions that work with contacts.

 

2. (Optional) If you created the class in the App_Code folder (or the Old_App_Code folder if you're using web application), register it as described in Developer's Guide -> API programming and Kentico CMS internals -> Registering custom classes in App_Code.

 

3. Override the Execute() method from the base class.

 

4. Write the code that you want executed by the action into the Execute method's body.

 

Action steps can have parameters (settings) specified that you can use to modify their behavior. You can then enter the parameter values when configuring an action step in the workflow designer. If you want your custom action step to rely on parameters, you can specify them when editing or creating an action on the Actions tab in Site Manager -> Tools -> On-line marketing -> Automation processes. To access the parameter's values in the code of an action, use the GetResolvedParameter method.

 

Registering actions in the system

 

Once you create the code for the custom action, register it.

 

1. Navigate to CMS Desk -> On-line marketing -> Processes and switch to the Actions tab.

 

2. Click on NewAction New action.

 

3. Fill in the following mandatory fields:

 

Display name - name of the action step.

Assembly name - name of the library that contains the action's code.

Class name - full name of the class that contains the action's code.

 

4. (Optional) Select the module the action will belong to.

 

5. (Optional) Define the action's parameters on the Parameters tab.

 

Note that you can register actions in Site manager -> Tools -> On-line marketing -> Automation processes as well.