Autorefresh in Workflow
A new feature is implemented in 7.1.3 where a workflow can automatically be refreshed when the Workflow window is activated.
A new column in table dat.workflowshas been added, called needs_refresh tinyint. If this column is set to 1, all users that have this workflow expanded in their workflow window will be refreshed when the workflow is activated. An activation of the Workflow window happens when the user clicks on the Workflow tab or when the Workflow window is automatically activated due to another form being closed.
Bizview itself will never set needs_refresh to 1. Instead, a custom procedure is required to do that. After Bizview has read the needs_refresh, it will set it to 0 and notify all users that the workflow needs a refresh.
There are two different approaches to force a Workflow to refresh: an indirect refresh and a direct refresh.
An indirect approach means that a procedure will update the column needs_refresh when something happens in Bizview. For example, when a Form is updated with certain values, a procedure will set some Workflows to refresh by setting needs_refresh to 1.
A direct refresh checks if the workflow needs to refresh at the moment the check is done. This is done by adding a procedure called [cust].[p_workflow_get_dirty_workflows]. The procedure needs to accept one parameter that is the client ID.
When the Workflow window is activated, this procedure will be executed if it exists and the procedure should return a data table with the workflows that should be refreshed.
Caution: This procedure disables the standard check where needs_refresh is set to 1. This means that the procedure should also return workflows where needs_refresh is set to 1 if that approach also is used.