Workflow States: Configuring Action States
You can configure an action in the following locations:
- A definition of the action in a graph or in one of its extensions
- A screen configuration
- A workflow state
This topic describes the configuration of actions in a workflow state. For details on configuring actions in a screen configuration, see Workflow Actions: Configuration of Actions.
Adding or Updating an Action in a Workflow State
To add or update a state of a field in a workflow state, you call the WithActions method in a lambda expression for the Add or Update method that defines a workflow state. Inside the WithActions method, you can do the following:
- Add a new action to the workflow state by calling the Add
method.Note: When you add an action in a workflow state, the action will be available in this state unless it is restricted by the settings defined in the screen configuration,—for example, by the condition in the IsHiddenWhen method.
- Update an action if it exists in the state of the base workflow by calling the Update method.
- Replace the entire configuration of the action by calling the Replace method.
- Delete the entire configuration of the action by calling the Remove method.
Configuring an Action in a Workflow State
You can configure an action in the following ways:
- Display an action on the form toolbar.
By default, all actions are displayed on the More menu. You can display an action on the form toolbar by calling the IsDuplicateInToolbar method while adding an action to a screen configuration.
- Specify a connotation for an action by calling the WithConnotation
method while adding an action to the screen configuration. The connotation will be
displayed for this action both on the More menu and on the form toolbar.
You can also cancel the connotation by calling the WithNoConnotation method.
- Specify that the action should be executed automatically when a provided condition is true by calling the IsAutoAction method.
An example of configuring an action in a workflow state is shown in the following code.
sss.Add<State.hold>(flowState =>
{
return flowState
.WithActions(actions =>
{
actions.Add(g => g.releaseFromHold,
a => a.IsDuplicatedInToolbar()
.WithConnotation(ActionConnotation.Success));
});
});
In the example above, the following changes have been made to the
releaseFromHold
action:
- The action is displayed on the form toolbar.
- The action is displayed with the Success connotation.