Change Process Data Variable Values

To change process data variables in your process, do the procedure in this topic.

Update Custom Attributes Screen



Good to Know

How to Start

  1. On the Application Explorer screen, do one of these:
  2. Do one of these:
    • Add an activity:
      1. In the Process Builder, in the Activity Library, open the Common Common icon tab.
      2. On the Common Common icon tab, drag the Update Process Data Update Process Data icon activity onto your process.
    • Change an activity:
      1. In your process, double-click your activity.
  3. On the Update Custom Attributes screen, click Update Custom Attributes Update Custom Attributes icon.

Procedure

  1. On the Update Custom Attributes screen, complete these fields.
    Field Name Definition

    Process Data Variable

    Function:
    Specifies the name of the process data variable that stores the return value for your code snippet.
    Accepted Values:
    • A process attribute.

      At runtime, if the process attribute does not exist, a new variable is created and the value is assigned.

    • An Xpath to an XML schema element.

      At runtime, if the schema element does not exist, the process ignores the action. If you want to change a repeatable XML element, make sure it exists in the schema.

    Default Value:
    None
    Accepts Process Data Variables:
    Yes
    Example:
    • Process attribute variable - EmployeeName
    • XML process variable - /pd:myFields/pd:empName

    Expression

    Function:
    Specifies a value your code snippet gives to the process data variable.

    The Expression field can not be blank.

    Accepted Values:
    Behind the scenes, the value in the Expression field is converted to complete this C# phrase:

    ds["/pd:AP/pd:formFields/pd:message"] = dsNew["/pd:AP/pd:formFields/pd:message"] = {Expression field value};

    As such, it is possible to have several different types of values, but in most cases, they must follow C# syntax.

    You can use any of the types of values in this list.

    A literal string value.

    • The string value must be enclosed within the quotation marks (" ").
    • The string must be in valid C# string format, which means no special characters that would cause the string to be misinterpreted as C# code.

    Examples:

    • "Mary Poppins"
    • "8675309"

    Behind the scenes, this creates C# code that looks like this:

    ds["/pd:AP/pd:formFields/pd:message"] = dsNew["/pd:AP/pd:formFields/pd:message"] = "8675309";

    A variable.

    If you use a variable in the Expression field, it initializes, or sets, the value of the variable in the Process Data Variable field to the current value of the variable in the Expression field when the Update Process Data activity runs.

    • You can use process data variables in either of these formats:
      • Process data - ${EmployeeName}
      • Xpath - ${/pd:myFields/pd:empName}
    • Do not enclose variables with quotation marks (" ").

    Behind the scenes, this creates C# code that looks like this:

    ds["/pd:AP/pd:formFields/pd:message"] = dsNew["/pd:AP/pd:formFields/pd:message"] = ds.Attr("/pd:AP/pd:myFields/pd:empName", pi, w);

    A C# code snippet.

    This is advanced functionality, and knowledge of the C# programming language is required. AgilePoint does not provide detailed documentation on how to use C# code in general. These are rules to understand if you already know how to program with C#. If you would like help with this feature, please contact AgilePoint Professional Services.

    • Any .NET methods must be available in one of these namespaces:
      • System
      • System.Collections
      • Ascentn.Workflow.Base
    • If you use variables in the C# snippet, they must obey these rules:
      • You can use either AgilePoint formatting or standard C# formatting.

        For example, you can use the format ${EmployeeName} or ds.Attr("EmployeeName", pi, w);

        The same as when you use only a variable in the Expression field, if you use the AgilePoint variable format, it is converted to C# format behind the scenes.

      • Your C# code must use type casting for the variables.

    Example:

    (${/pd:AP/pd:formFields/pd:employee1}).ToString().ToUpper() + " and " +(${/pd:AP/pd:formFields/pd:employee2}).ToString().ToUpper()

    In this example, the values of employee1 (Poppins) and employee2 (Van Dyke) are converted to all capital letters (UPPER CASE). It also combines both values with the word "and". This is the result: POPPINS and VAN DYKE.

    Behind the scenes, this creates C# code that looks like this:

    ds["/pd:AP/pd:formFields/pd:message"] = 
    dsNew["/pd:AP/pd:formFields/pd:message"] 
    = ds["/pd:AP/pd:formFields/pd:message"] = 
    dsNew["/pd:AP/pd:formFields/pd:message"] 
    = (ds.Attr("/pd:AP/pd:formFields/pd:employee1", 
    pi, w)).ToString().ToUpper() 
    + " and " 
    +(ds.Attr("/pd:AP/pd:formFields/pd:employee2", 
    pi, w)).ToString().ToUpper();
    Default Value:
    None
    Accepts Process Data Variables:
    Yes
  2. To validate your code, click Verify Verify icon.

Related Topics