Primitive Attribute Workflows
You can incorporate basic rules and dynamic behavior for the values of primitive attributes by defining primitive attribute workflows. You apply a primitive attribute workflow by adding the workflow to an asset type containing the workflow’s primitive attribute.
The workflow state for the workflow of a primitive attribute is determined by the current value of the attribute on the Asset page. The workflow transitions for the workflow describe updates to this value. Such transitions may optionally be represented on the Asset page as buttons, with the transition’s label used for the button text. Clicking a button saves a new version of the asset with the updated attribute value. You can define any number of workflows for a specific primitive attribute.
The Primitive Attribute Workflows page, opened by clicking Primitive Workflows in the Database navigation sidebar, shows a table with all primitive attribute workflows in the database. The table columns are:
The Label column — the label of the primitive attribute workflow.
The Mode column — the mode for the workflow. Either Process workflow or Free workflow.
The Description column — the optional description of the primitive attribute workflow.
Click on the label of a primitive attribute workflow in the table to show more details for that primitive attribute workflow. Click the Add button to add a new primitive attribute workflow.
Adding Primitive Attribute Workflows
To add a new primitive attribute workflow:
1
Workflows can be defined for all types of primitive attributes, although some workflow functionality is only available for a subset of types — see also Value Types.
2
Select the mode for the workflow from the Mode list — either Process workflow or Free workflow.
A process workflow puts restrictions on the possible values for the primitive attribute, as well as how these values can be updated from one value to the next. It may be used, for example, to define various stages of a project- or task-like asset. A free workflow imposes no such restrictions. See also Process Workflows and Free Workflows.
3
4
Click Continue to continue to the next page.
The Add Primitive Attribute Workflow page shows the primitive attribute, workflow mode, and workflow label provided on the previous page in the Attribute, Mode, and Label fields, respectively.
5
A primitive attribute workflow contains lists of State Conditions, Transitions, and Permissions. A list can be left empty. Click Save to add the new primitive attribute workflow once you are finished setting these lists up.
To apply the primitive attribute workflow to your assets, you must also add the workflow as a member workflow to an asset type or to a composite attribute workflow — see Using Workflows with Asset Types and Composite Attribute Workflows.
State Conditions
The state conditions for a primitive attribute workflow are conditions posed on the attribute’s values. Given an attribute value, a state condition is either satisfied or not satisfied. The simplest type of state condition is a state value. A state value is satisfied as a state condition if its corresponding value is either equal to that of the attribute or, for an attribute of value type Keyword array or User array, is an element of the attribute’s array. Given this correspondence between state values and attribute values, a workflow state for a primitive attribute workflow may also be defined as a collection of state values.
A state condition can be formulated as a state expression via a filter expression written using a subset of the Model Manager search syntax. The state condition is satisfied if it matches state values as a logical expression. The workflow management system also includes built-in state conditions that can be used as dynamic shorthands for state values and state expressions.
A state value, as well as the built-in state conditions Current timestamp and Current user, may be set as a default state condition. The corresponding value of a default state condition is automatically set for a primitive attribute if the current attribute value is empty.
For a primitive attribute with a list of allowed values, the Add Primitive Attribute Workflow page is automatically populated with state conditions of type State value corresponding to each allowed value. The sort order for the state conditions is the same as defined for the allowed values. Click the Delete button (trashcan) to remove an unwanted state condition. Click the up and down arrow buttons to change the sort position of a state condition.
To add a state condition to the workflow:
1
Select the type of state condition to add in the Add State Condition menu. Select from State value, State expression, or one of the built-in state conditions — see also Table 3-8.
A State value or State expression condition is only available for primitive attributes of value type Boolean, Integer, Keyword, Keyword array, User, and User array.
The available built-in state conditions depend on the attribute type. A Current timestamp condition may be used for an attribute of type Timestamp; a Current user or Not current user condition may be used for an attribute of type User or User array. A built-in state condition can only be added once to the list of state conditions.
2
For a State value or State expression, write the label of the state condition in the Label field. Write an optional description in the Description field.
3
For a State value, specify the corresponding value for the state condition in the Value field. For Integer, Keyword, and Keyword array, write the state value in the input field. For Boolean, User, and User array, select the state value from the list.
For a State expression, specify the expression statement in the Expression field. Write the statement as @<attribute-identifier>:<state-value-expression> using the identifier of the primitive attribute and an expression involving state values. Remember to escape spaces in state values with backslashes.
4
Select the Default checkbox to enable a state condition as a default state condition.
The Default field is only available for a State value or a built-in state condition of type Current user and Current timestamp. Only a single state condition can have a selected checkbox if the value type is Boolean, Integer, Keyword, or User. Selecting a second checkbox automatically clears the currently selected checkbox. Multiple checkboxes can be selected if the value type is Keyword array or User array.
State expressions support a subset of the Model Manager search syntax. You can combine state values with boolean AND and OR operators, use NOT and ANY operators, as well as group state values with parentheses. Use of wildcard characters (except ANY) or ranges is not supported. See also Primitive Attribute Field Expressions.
You introduce a default value for a primitive attribute by defining a workflow for the attribute having a State value condition set as a default state condition. The workflow must also be added to relevant asset types.
While primitive attributes of value types other than Boolean, Integer, Keyword, Keyword array, User, and User array cannot have state conditions of type State value or State expression, they can use built-in state conditions. Such workflows may be useful as member workflows of composite attribute workflows or asset type workflows when defining activities for transitions — see Composite Attribute Workflows and Using Workflows with Asset Types. You can also control which users can update the primitive attributes by adding permissions to their workflows.
Table 3-8: All available state conditions of built-in type for a primitive attribute workflow..
A condition that is always satisfied. Combines the Any state value and No state value built-in state conditions.
A state condition of type Never is primarily useful to temporarily disable a transition by adding it as a from-state condition or as a to-state condition — see Transitions.
Transitions
The transitions for a primitive attribute workflow correspond to changes made to the attribute value when saving an asset. Transitions are expressed as a collection of state conditions that match attribute values before the save, known as the from-state conditions, and a collection of state conditions that match attribute values after the save, known as the to-state conditions. A transition is enabled (“can occur”) if the from-state conditions are all satisfied for the asset; an enabled transition has fired (“occurred”) if the to-state conditions are all satisfied for the saved asset. The state conditions need not all be state values; using a state expression or a built-in state condition for a from- or to-state condition is also possible. The collection of from-state conditions may be empty, in which case the transition is enabled when the value is empty. The analogous holds true for empty to-state conditions.
An action transition is a transition that is actively initiated by a user. When the transition is enabled — that is, when its from-state conditions are all satisfied — a corresponding button is displayed on the Asset page. The label of the transition is used for the button text; the description is used for the tooltip. Clicking the button removes all state values matched by the from-state conditions and adds all state values identified by the to-state conditions. If more than one action transition is enabled, the remaining ones are available as menu options on the Asset page.
A general transition is used to automate behavior that should happen when a user updates an asset according to the pattern prescribed by the transition’s from- and to-state conditions. There are no restrictions on the types of state conditions that may be used for such transitions.
For a process workflow defined for a primitive attribute with allowed values, the Add Primitive Attribute Workflow page is populated with action transitions between the allowed values, with one transition per adjacent pair of values. Click the Delete button (trashcan) to remove an unwanted transition. Click the up and down arrow buttons to change the sort position of a transition.
The sort order for transitions is used when displaying these on the Primitive Attribute Workflow page. It is also used to determine the order of the button and menu options on the Asset page when a transition is enabled: the first enabled transition is shown for the button, the other as menu options via an expander button.
To add a transition to the workflow:
1
Click Add Transition to add a general transition. Click Add Action Transition to add an action transition.
2
Write the label of the transition in the Label field. Write an optional description in the Description field.
3
In the From field, select state conditions to add as from-state conditions for the transition.
Any number of state conditions can be added if the primitive attribute has value type Keyword array or a User array. Otherwise, zero or one condition can be added. For an action transition, only a State value condition or a built-in condition of type Always, Any state value, Current timestamp, Current user, Never, or No state value can be added. A State expression or Not current user cannot be used as a from-state condition for action transitions. A general transition has no restrictions on the supported state condition types.
4
In the To field, select state conditions to add as to-state conditions for the transition.
The requirements for the to-state conditions are similar to the From field except that Always, Any state value, Never, and No state value are disallowed for action transitions — only State value, Current user, and Current timestamp are allowed.
5
In the Permissions table for the transition, add users and groups that are granted permission to perform the transition. Leave the table empty to grant everyone permission. See also Permissions for changing the primitive attribute value itself.
For a Process workflow, any update to a primitive attribute value must happen through the firing of an action transition. State values corresponding to the from-state conditions of the action transition are removed, and state values corresponding to the to-state conditions are added.
If multiple transitions fire for the workflow when saving an asset, the overall authorization succeeds if the current user is granted permission to perform all general transitions that fired and, if any action transitions fired, at least one of those action transitions.
Action transitions for a primitive attribute of value type Timestamp do not appear as buttons on the Asset page.
A workflow having multiple from-state and to-state conditions in its transitions can be defined using a Checkbox list or a List box attribute. It could be used for a process in which an asset can be in “multiple stages” at the same time. An example would be a status-like attribute for which separate tasks need to be finished before the asset can move to the next stage, and these tasks are worked on in parallel.
Permissions
To grant permissions to users and groups that can update the value of the primitive attribute:
1
Add a user or group to the Permissions table at the bottom of the page.
2
In the Permissions with State Conditions table cell, next to the Change value permission type, add state conditions from the Add State Condition menu to conditionally grant the permission.
The Change value permission is granted to the user or group if at least one state condition is satisfied by the primitive attribute value before saving the asset. The permission is always granted if the collection of state conditions is empty.
The Primitive Attribute Workflow Page
The Primitive Attribute Workflow page contains details on a primitive attribute workflow in the database. The fields are:
Attribute. The primitive attribute for the workflow.
Mode. The mode for the workflow — either Process workflow or Free workflow.
Label. The label for the workflow.
Description. The optional description for the workflow.
State conditions. The list of state conditions for the workflow. Hidden if the workflow does not have any state conditions.
The state conditions are listed as three groups: all conditions of type State value, all state conditions of type State expression, and finally all built-in state conditions.
Transitions. The list of transitions for the workflow, including their from-state condition, to-state conditions, and granted permissions. Hidden if the workflow does not have any transitions.
Permissions. The list of granted permissions for changing the value of the primitive attribute. Hidden if no permissions have been explicitly granted, which means that all users are allowed to change the attribute value.
Click Edit to edit the primitive attribute workflow.
Click Delete Permanently if you want to permanently delete the primitive attribute workflow in the database. The workflow will be automatically removed from any asset type using it, as well as from any composite attribute workflow it is a member of.
Examples of Workflows for Primitive Attributes
This section lists a few applications of workflows for primitive attributes.
Default Option
Given an Approval attribute of widget type Radio button with allowed values Approved and Not approved, you may want Not approved selected by default when adding a new asset. Define a Free workflow for Approval with a State value condition having Value set to Not approved and for which the Default checkbox is selected.
Assign to Me
Given a Responsible attribute of widget type User picker, you may want the value to initialize to the user adding a new asset. You also want to enable other users to quickly assign themselves as the responsible. Define a Free workflow for Responsible with a built-in state condition Current user for which the Default checkbox is selected. Define an action transition labeled Assign to Me with from-state condition Always and a to-state condition Current user. An Assign to Me button will be present next to the Responsible attribute on the Asset page.
Restricted Attribute
Given an attribute value that only a restricted group of users should be able to update, define a Free workflow for the attribute with a Change value permission granted to that group.
Status Workflow
Given a Status attribute of widget type Combo box with allowed values Suggested, Approved, Implementing, Completed, and Canceled, define a Process workflow with one State value condition for each allowed value. Also add a built-in Any state value condition. Set the Suggested state value to be a default state condition so that the workflow initializes in the “suggested stage”.
Define five action transitions with the from- and to-state condition mappings: Suggested to Approved, Approved to Suggested, Approved to Implementing, Implementing to Approved, and Implementing to Completed. Also add an action transition with the from- and to-state condition mapping Any state value to Canceled. This workflow describes a simple work process of reversible stages that can be canceled at any stage.
Multiple-Approval Workflow
Given a Project Proposal attribute of widget type Checkbox list with allowed values Draft, Pending Approval by Engineering, Pending Approval by Sales, Approved by Engineering, Approved by Sales, and Approved by Management, define a Process workflow with one State value condition for each allowed value. Set Draft to be a default state condition so that the workflow initializes in the “draft stage”.
Define action transitions that enable a process in which the proposal is reviewed and approved in parallel by the engineering and sales departments, and then when both have approved, the proposal is reviewed and approved by management:
Label: Request Approval
From: Draft
To: [Pending Approval by Engineering, Pending Approval by Sales]
Permission: (Everyone)
 
Label: Approve (Engineering)
From: Pending Approval by Engineering
To: Approved by Engineering
Permission: Engineering Group
 
Label: Approve (Sales)
From: Pending Approval by Sales
To: Approved by Sales
Permission: Sales Group
 
Label: Approve (Management)
From: [Approved by Engineering, Approved by Sales]
To: Approved by Management
Permission: Management Group
When the attribute value is Draft, the Asset page displays the Approve (Engineering) and the Approve (Sales) action transitions as button and menu options. Either option may be triggered first. After both options have been triggered (irrespective of order), the attribute value is [Approved by Engineering, Approved by Sales] and an Approve (Management) button is shown. Only users from each respective group are granted permission to perform their transitions for approval.