Workflow-related attributes in the Vault Application Framework
The following attributes can be use to associated C# methods with workflow-related functionality within the M-Files vault.
Workflow State Actions
The StateActionAttribute
attribute marks the following method to be executed when an object reaches a state in a workflow.
[StateAction("MyWorkflowStateAlias")]
public void WorkflowStateAction(StateEnvironment env)
{
}
State Pre-Conditions
The StatePreConditionsAttribute
attribute marks the following method to be executed to determine whether an object can enter a state in a workflow.
[StatePreConditions("MyWorkflowStateAlias")]
public bool MyStatePreConditions(StateEnvironment env, out string message)
{
message = "The object cannot enter this state.";
return false;
}
State Post-Conditions
The StatePostConditionsAttribute
attribute marks the following method to be executed to determine whether an object can leave a state in a workflow.
[StatePostConditions("MyWorkflowStateAlias")]
public bool MyStatePostConditions(StateEnvironment env, out string message)
{
message = "The object cannot leave this state.";
return false;
}
Automatic State Transitions
The AutomaticStateTransitionTriggerAttribute
attribute marks the following method to be executed to determine whether an object should automatically transition between workflow states.
[AutomaticStateTransitionTrigger("MyWorkflowStateTransitionAlias")]
public bool MyAutomaticStateTransitionTrigger(StateTransitionEnvironment env, out int nextState)
{
nextState = 101; // The Id of the state to transition to.
return false;
}
M-Files evaluates the state transition trigger every 60 minutes, and every time the object is changed.