Skip to content

Workflow Navigation

Workflow navigation provides the ability to define a set of pages and assistants which can be shown within “related pages” and can be navigated across much like assistant pages using the header buttons provided in the client app.

Workflow Header

The workflow keyword should be defined within a page. A page may include multiple workflows.

Example:

page WorkOrderDetail using WorkOrders {  
     ...  
     workflow StartWorkOrderWorkflow;  
     workflow CompleteWorkOrderWorkflow;  
     ...  
}  

The identifier after the workflow keyword should refer to a workflow defined in the *.client file. A workflow definition may contain the following items within it.

  • Initialization command (optional, label supported)
  • Dynamic set-up function to retrieve the available steps and the order of them (optional)
  • The list of step definitions

A step definition is used to specify the properties of each step. If the dynamic set-up function is not defined, then the client will show all the steps defined in the workflow in the same order. If a dynamic set-up function is specified, then it will be executed to get which steps in the workflow are available for the current record and the sequence.

A step definition may contain the following items within it. Each step should be named.

  • Label
  • Icon (optional)
  • Emphasis (optional)
  • Navigate definition - provide a page name (column filters supported) or an assistant
  • Next command (optional) - This will be executed before navigating to the next step. It allows us to perform any checks before letting the user navigate any further. The content of this should be like a normal command (having variables and an execute block). It is only allowed to continue if this method returns “exit OK”.

The dynamic set-up function may accept any number of parameters and should return a list of structure type FndWorkflowStep. This structure has an attribute called Name which can be set to one of the step names defined in the workflow.

An example workflow in the *.client file is given below:

Client:

workflow WorkOrderWorkflow for TstOffWorkOrder {  
   init command {  
      label = "Start Workflow";  
      execute {  
         alert("Starting completion process of work order...");  
      }  
   }  

   dynamic GenerateWorkflowSteps(WoNo);  

   steps {  
      step TimeReportsStep {  
         label = "Time Report";  
         icon = "clock";  
         emphasis Complementary6 = [true];  
         navigate WorkOrderTimeReportsPage(WoNo);  

         next command {  
            variable Result1;  
            variable ConfirmResult;  
            execute {  
               call IsWorkflowStepValid(WoNo, "TimeReportsStep") into Result1;  

               if [Result1 = true] {  
                  confirm("Do you really want to move to the next step?") {  
                     when OK {  
                        exit OK;  
                     }  
                  }  
               }  
            }  
         }  
      }  

      step LineChartStep {  
         label = "Line Chart";  
         icon = "line-chart";  
         emphasis Complementary9 = [true];  
         navigate LineChartDataPage(WoNo);  
      }  

      step FinishWoAssistantStep {  
         label = "Finish WO";  
         navigate FinishWoAssistant;  
      }  
   }  
}  

Projection:

function GenerateWorkflowSteps List<Structure(FndWorkflowStep)> {  
    parameter WoNo Number;  
}  

function IsWorkflowStepValid Boolean {  
    parameter WoNo Number;  
    parameter WorkflowStepName Text;  
}  

Offline file:

@Overtake Core  
procedure Function<GenerateWorkflowSteps> List<Structure(FndWorkflowStep)> {  
    parameter WoNo Number;  
    variable StepsList List<Structure(FndWorkflowStep)>;  
    variable Step Structure(FndWorkflowStep);  
    execute {  
        create Step;  
        set Step.Name = "LineChartStep";  
        call List.Add(StepsList, Step);  

        create Step;  
        set Step.Name = "TimeReportsStep";  
        call List.Add(StepsList, Step);  

        create Step;  
        set Step.Name = "FinishWoAssistantStep";  
        call List.Add(StepsList, Step);  

        return StepsList;  
    }  
}  

@Overtake Core  
procedure Function<IsWorkflowStepValid> Boolean {  
    parameter WoNo Number;  
    parameter WorkflowStepName Text;  
    execute {  
        return true;  
    }  
}  

In this example, you can observe:

  • There is an initialization command which has the label “Start Workflow”. It will appear first, before any of the workflow steps. This command will show an alert message and then automatically proceed to the first workflow step. This command is provided so that you can set up any variables and/or show information messages to the user before beginning the workflow.
  • It’s possible to navigate directly into any workflow step without using this initialization command, in which case it won’t be executed.
  • A dynamic set-up function is defined, called “GenerateWorkflowSteps” and the current record’s “WoNo” column is passed in as a parameter. Such parameters can be used to determine the available steps and their order from within the function.
  • The steps list contains 3 steps defined within it.
  • The first step in the steps list is called “TimeReportsStep” and it has a label, icon and an emphasis defined. It will navigate to the page “WorkOrderTimeReportsPage” with a column filter set for “WoNo”.
  • There is a “next command” defined for the above step. The condition where it returns “exit OK” is the only scenario where navigating to the next step is possible.
  • The second step in the list is called “LineChartStep” and it also has a label, icon and an emphasis defined. It will navigate to the page “LineChartDataPage” with a column filter set for “WoNo”.
  • The last step on the list “FinishWoAssistantStep” only has a label defined, and it will navigate to an assistant “FinishWoAssistant” instead of a page.
  • However, looking at the .offline file, we can see how the “GenerateWorkflowSteps” function is implemented. Even though in the.client file, the steps are defined in the order TimeReportsStep, LineChartStep and FinishWoAssistantStep, it can be changed by using this dynamic function. The example shows that the LineChartStep is added first to the list, so that will be the sequence the steps are shown in the client.

When all the steps are returned from the dynamic set-up function and they are added to the list of related pages, they will appear in the order in the below image (screenshot shown from the Windows client, the appearance of any items depicted may be subject to change).

Workflow Related Pages

As you have your workflow defined above, you can use a command to navigate to a specific step in your workflow.

Client:

command GoToWorkflowStep {  
   label = "Work flow step 2";  
   enabled = [true];  
   execute {  
      navigate {  
         workflow WorkOrderWorkflow.TimeReportsStep;  
      }  
   }  
}  

Hide Workflow commands from Navigation Menu

There is a property on the workflow steps that can be defined for each step. If you don't want the step displaying in the navigation menu, but do want it displaying in the top navigation header, you can add the property hideworkflowcommand to a step and set it to true. The default value is false, so it is only needed on the steps that you want to hide.

Client:

step LineChartStep {  
   label = "Line Chart";  
   hideworkflowcommand = true;  
   navigate LineChartDataPage(WoNo);  
}  

Change Workflow visiblity

There is a 'visible' property that can be evaluated under the workflow keyword that can be used to define if a workflow is visible or not, an example is below.

workflow WorkOrderWorkflow for TstOffWorkOrder {  
   visible = [Objstate != "REJECTED"];  
   init command {  
      label = "Start Workflow";  
      execute {  
         alert("Starting completion process of work order...");  
      }  
   }