Show TOC

Procedure documentationDefining Custom Attributes and Custom Actions for Tasks Locate this document in the navigation structure

 

The custom attributes help users to take appropriate steps and decisions on tasks by providing relevant business context information. Custom actions help the users to perform additional actions on the tasks without even opening the tasks. Custom attributes and custom actions for tasks can be defined in the process composer. These attributes and actions can be then exposed through the BPM API and made visible in the users' task list.

Procedure

Editing the Task
  1. In the Developer Studio, choose   Window   Open Perspective   Other...   Process Development   and choose OK.

  2. Expand your project in the Project Explorer view.

  3. Expand Process Modeling, then expand Tasks.

  4. In the context menu of a task, choose Open.

    The task editor opens.

  5. Go to the Attributes and Actions tab page.

Defining Custom Attributes
  1. On the Attributes and Actions tab page, in the Custom Attributes panel, choose Add.

    In the Attributes table, a new entry is displayed.

  2. Click the name of the new entry and overwrite it with the name of your custom attribute.

    Note Note

    The custom attribute's name can only contain alphanumeric characters and must start with an alphabetic character.

    It is not possible to have several custom attributes with the same name.

    End of the note.
  3. Enter a description for the custom attribute in the Label column. This label is translated in the user's task list based on the logon language in case it is localized. For more information about internationalizing Java and J2EE projects, see Internationalization of Java Projects.

  4. In the Type column, select the data type of the custom attribute to determine what type of value the expression must return.

    Caution Caution

    Restriction: If the returned value is of the data type string and at runtime the expression returns a string with a length that is greater than 255 characters, the string is truncated to 255 characters.

    End of the caution.
  5. Select the row with the custom attribute and choose Edit.

    The Expression Editor opens.

  6. Enter an expression for the custom attribute by using the task context, for example, the task attributes and the task input. You can also use BPM rules and functions defined in the process. The expression returns the value of the custom attribute.

  7. Choose OK and save the task.

  8. To delete a custom attribute from the task, select it in the Attributes table and choose Remove.

  9. You can rearrange the order of the custom attributes with the Move up and Move Down buttons. The order of the custom attributes in the Attributes table will be the same when the custom attributes are retrieved from BPM Public API.

  10. Save your task settings.

The user can now see the defined attributes in the task inbox by filtering by task type. The expression will be calculated using the real process data and will be visible as a value. The BPM Public API provides methods, which allow you to get the custom attributes of the task and their values.

Defining Custom Actions
  1. On the Attributes and Actions tab page, in the Custom Actions panel, choose Add.

    In the Actions table, a new entry is displayed.

  2. Click the name of the new entry and overwrite it with the name of your custom action.

    Note Note

    The custom action's name can only contain alphanumeric characters and must start with an alphabetic character.

    It is not possible to have several custom actions with the same name.

    End of the note.
  3. Enter a short description for the custom action in the Label column. This label is translated in the user's task list based on the logon language in case it is localized. For more information about internationalizing Java and J2EE projects, see Internationalization of Java Projects.

  4. In the Description field, you can enter a detailed description of the action. The description is also translated.

  5. To delete a custom action from the task, select it in the Attributes table and choose Remove.

  6. You can rearrange the order of the custom actions. with the Move up and Move Down buttons. The order of the custom action in the Actions table is preserved when the actions are later fetched during runtime.

  7. Save your task settings.

  8. Open the output mapping of the task that has custom actions.

    Under TaskOutput and TaskAttribute, you can find an attribute CustomAction. This attribute will be populated with the custom action name with which the task has been completed during runtime.

  9. Drag and drop the attribute to a context data object.

  10. Save the activity including the task output mapping.

The user can now complete a task in the task inbox using the defined custom action. The BPM Public API provides a complete method that accepts the defined custom action as a parameter.