Documentation Center

Creating an Automatic Activity in a Process Definition

An Automatic Workflow Activity is an Activity consisting of script code performed by Content Manager, and requires no user input. In Workflow Designer, create one by dragging a shape onto the work area and specifying properties. You can also specify expiration script code for the Activity.

Procedure

  1. Add an Automatic Activity to the Process Definition by dragging and dropping one of the following SDL Tridion Sites Workflow Shapes from the stencil window to the work area:
    ShapeDescription
    Automatic Activity: the Activity script code contains logic to perform the Activity.
    Automatic Decision Activity: the Activity script code contains logic to perform the Activity, and to decide what the next Activity will be.

    If this is the first Activity of a Process Definition, and the Process is applied to a classic editing workflow, the Activity cannot be Automatic.

  2. Double-click the shape in the work area.

    An Automatic Activity Properties dialog opens.

  3. Set the following mandatory properties:
    OptionDescription
    TitleThe name of this Activity Definition as it will appear to the user
    DescriptionA description of the Activity Definition as it will appear to the user
  4. Specify the Activity script to execute in order to perform the Activity:
    Script Type
    The type of script:
    • Select C# to edit C# code directly in Workflow Designer.
    • Select External Activity to refer to an external .NET assembly, uploaded to a Template Building Block.
    • If you have Translation Manager set up, select Translation Manager activity to enter a Translation Manager workflow command (one all-uppercase word).
    Edit Script
    Opens a dialog in which you can enter Activity script code (actual C# code, a .NET assembly reference or a Translation Manager workflow command). The syntax of the code you enter is different depending on the type of code:
    C# code or External Activity (.NET assembly reference)

    This is C# syntax, recognizable because it uses semicolons.

    Here is an example of actual code:
    ActivityFinishData finishData = new ActivityFinishData()
    {
    	Message = "Finished"
    };
    SessionAwareCoreServiceClient.FinishActivity(CurrentActivityInstance.Id, finishData, null);
    Here is an example of a .NET assembly reference, which only identifies the Content Manager identifier of the associated .NET Assembly Template Building Block and the name of a class:
    AssemblyTbbId = "tcm:1-2-2048"; 
    Type = "MyWorkflow.MyActivityClass";
    Translation Manager Worfklow command
    This is custom syntax, always a string in all uppercase, for example:
    RETRIEVE
  5. Optional: Under Approval Status, select the status that you want the items related to this Activity to have, after the Activity is finished.
  6. Optional: To constrain what the Activity script can and cannot do as part of this Activity, select options in the Constraints area:
    Deny items to be added/removed

    Prohibits the script from adding or removing items in the Process.

    Deny Subject(s) to be edited

    Prohibits the script from editing content items associated with the Activity.

    Deny Bundle metadata to be edited

    Prohibits the script from editing the metadata of a Bundle associated with the Activity.

  7. Optional: To set, or to allow the script to set, a time constraint on this Activity, select options in the lower half of the dialog:
    Allow to override due date

    If selected, this option allows the script to do one of the following:

    • If no period is specified under Expires in, the script can set a due date for the specific Activity Instance.
    • If a period is specified, the script can change the due date of the Activity Instance.
    Expires in

    The maximum amount of time allotted for this Activity. The time starts running when the Activity is assigned, and stops when the Activity is finished. Specify the amount of time in minutes, hours, days or weeks. A value of 0 indicates that the Activity has no time limit. You can calculate the default due date for the Activity: this is the moment of assignment + the amount of time specified here.

  8. If either Allow to override due date is set or if Expires in is set to a value higher than 0, you can tell Content Manager to execute an expiration script when the due date for the Activity has expired:
    Expiration Script Type
    The type of script:
    • Select C# to edit C# code directly in Workflow Designer.
    • Select External Activity to refer to an external .NET assembly, uploaded to a Template Building Block.
    • If you have Translation Manager set up, select Translation Manager activity to enter a Translation Manager workflow command (one all-uppercase word).
    Edit Expiration Script

    Opens a dialog in which you can enter expiration script code (actual code, a .NET assembly reference or a Translation Manager workflow command).

  9. Click OK to create the Activity.