Skip to main content

Business Flow feature

Video tutorial

Business flow applying

The Business Flow feature is intended to simplify the connection between a form and a workflow. You can use it to show different forms depending on the state of the document and the user role. In order to start working with the Business Flow you need to create a workflow scheme and a set of forms which will be shown depending on the state of the workflow and the user role.

Have a look at what Business Flow for a VacationRequest workflow would look like if we needed to change the way the data is displayed to users who can't approve of it at the current stage.

Business Flow

The minimal set of attributes for Business Flow is as follows:

  • Name - name, Business Flow identifier.
  • Scheme - workflow scheme the Business Flow is applied to.
  • Default Form - form, which will be displayed if no form that matches the conditions set in the Mappings section is found.

The Mapping section allows you to set a form for any document state and user role. Each line of this section has the following mandatory attributes:

  • States - a list of states of the workflow from the workflow scheme which this line is applicable to. It can have a special value Any state meaning that it is applicable to all possible workflow states.
  • Roles - a list of roles that the line is applicable to. It can have a special value Any role meaning that it is applicable to all possible roles.
  • Form - name of the form that is displayed.

The search for a form to be displayed is done with the following priorities:

  • The highest priority is given to the line which has an explicit workflow state and role of a logged-in user. Thus, the VacationRequest workflow that's in the BigBossSigning state and has a user with the BigBoss role will be shown a DocumentEdit form according to the third line from the top in the Mapping section.
  • Then priority is given to the line which has an explicit workflow state and the Role attribute has the Any role value.
  • Then priority is given to the line which has the Any state value of the States attribute, and the Role attribute has an explicit role of a logged-in user.
  • The lowest priority is given to the line which has the Any state value of the States attribute and the Any role value in the Role attribute.

If an appropriate line is not found after the search then the form specified in the Default Form attribute will be used.

In order to map a grid, rather than a specific form, to the Business Flow you need to specify two attributes in its settings:

  • Edit Type should equal to Flow.
  • Edit Flow should equal to the name of the Business Flow, which you would like to use with this grid.

Business Flow in a Grid

Differences between Form and Flow

There are more similarities rather than differences in the way Form and Flow operate, hence we will describe only the differences. There are two:

  • The <FlowContent/> component is used instead of <FormContent/>. <FlowContent/> is also a wrapper over <DWKitForm/> and is intended to connect form data with global client states. The only difference in the lifecycle of the FlowContent component compared to <FormContent/> is that it requests the form model at the /flow/{flowname}/ URL instead of /form/{formName}. You can read more on <FormContent/> and <DWKitForm/> components here.
  • The form model is requested via the UserInterfaceController.GetFlow(flowName, urlFilter) method. Since the form displayed by the Flow inter alia depends on the state of the workflow, the urlFilter parameter which equals to the value of the primary key of the workflow is passed to the controller. Then the form is selected according to the Mapping section specified in the BusinessFlow with the flowName name and the selected form is returned to the client.

Deep customization of the Business Flow

In some cases you might need to implement a more complex form search logic. In order to do that we recommend to rewrite the UserInterfaceController.GetFlow(flowName, urlFilter) method. You know the name of the Business Flow and the primary key of the workflow in this method, hence you can write any tricky logic of selecting the form that should be displayed to the user.