Is this really the version you are looking for? Kentico Xperience 8 Documentation is no longer updated. Use the switcher in the header to choose your product version.
Kentico EMS required
Features described on this page require the Kentico EMS license.
Kentico enables you to write your own actions that you will be able to incorporate into a workflow process. The procedure consists of two steps - writing the code of the action and registering the action into the system.
Action steps can have parameters (settings) specified that you can use to modify their behavior. You can then enter the parameter's 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 on the Actions of the application. To access the parameter's values in the code of an action, use the method.
To access the data of the document that will go through the action step, use the Node object and its properties.
using System;
using CMS.DocumentEngine;
using CMS.Membership;
public class CustomAction : DocumentWorkflowAction
{
public override void Execute()
{
// Gets the parameter value or assigns a default value - an empty string
string appendText = GetResolvedParameter("MyParameter", "");
// Appends the parameter value to the name of the document
Node.DocumentName += appendText;
// Saves the changes into the database
TreeProvider tree = new TreeProvider(MembershipContext.AuthenticatedUser);
DocumentHelper.UpdateDocument(Node, tree);
}
}If you create the class in the App_Code folder (or CMSApp_AppCode -> Old_App_Code if your project is a web application), add the RegisterCustomClass assembly attribute to register the class.
See Loading custom classes from App_Code for more information.