Forum Discussion

RobbSalzmann's avatar
RobbSalzmann
Valued Contributor II
2 years ago

How to Update UI Workflow Status When Run Via Extensibility Rule

We have several workflows that involve many steps.  The requirement is to have a button in a dashboard that runs the entire sequence or sequences.  This is coded and works.

The problem is when running workflows using a BR, the UI status doesn't update unless the refresh button is clicked.  This action is not practical when operating in a dashboard because it closes the dashboard.

How can I update the UI workflow status indications from the business rule?

I need to go from this:

To this:

Without clicking this:

 

Or leaving the dashboard.

  • NicolasArgente's avatar
    NicolasArgente
    Valued Contributor

    Hi RobbSalzmann 
    Have you tried that :

     

    'Can be called from a dashboard extender business rule:
    Dim selectionResult As New XFSelectionChangedTaskResult()
    selectionResult.WorkflowWasChangedbyBusinessRule = True
    Return selectionResult

    Source : Accepted Code Samples
    Thanks

    • RobbSalzmann's avatar
      RobbSalzmann
      Valued Contributor II

      Thanks NicolasArgente .  Yes, I have the following, with no effect on updating the UI:

       

        Dim selectionChangedTaskResult As XFSelectionChangedTaskResult = Nothing      
      ...
      
         selectionChangedTaskResult = New XFSelectionChangedTaskResult With { 
         	.IsOK = True, 
      	.WorkflowWasChangedByBusinessRule = True, 
      	.PovWasChangedByBusinessRule = True,
      	.ChangeSelectionChangedUIActionInDashboard = True
      	.ChangeSelectionChangedUIActionInDashboard = XFSelectionChangedUIActionType.Refresh
         }
      
      ...
      
      Return selectionChangedTaskResult 

       

       

  • MikeG's avatar
    MikeG
    Contributor III

    I was able to get this to work.  There are API calls to complete each step along the way, Import > Validate > Load (or Process) or also Confirm steps.  See if you can grab snippets of the code below to support your specific rule and solution:

     

    selectionChangedTaskResult.WorkflowWasChangedByBusinessRule = True
    selectionChangedTaskResult.IsOK = True
    selectionChangedTaskResult.ShowMessageBox = True
    '---other code
    '----set status
    If Not wfStatus.GetOverallStatus().Equals(WorkflowStatusTypes.Completed) Then

    'Complete workspace
    BRApi.Workflow.Status.SetWorkflowStatus(si, currentWF, StepClassificationTypes.Workspace, WorkflowStatusTypes.Completed, "Workspace Completed", "", "User clicked complete workflow", Guid.Empty)
    'Complete import
    Dim objLoadTransformProcessInfo As LoadTransformProcessInfo = BRApi.Import.Process.ExecuteParseAndTransform(si, currentWF, "", Nothing, TransformLoadMethodTypes.Replace, SourceDataOriginTypes.FromDirectConnection, False)
    'Complete validate
    Dim objValidationTransformationProcessInfo As ValidationTransformationProcessInfo = BRApi.Import.Process.ValidateTransformation(si, currentWF, True)
    Dim objValidateIntersectionProcessInfo As ValidateIntersectionProcessInfo = BRApi.Import.Process.ValidateIntersections(si, currentWF, True)
    'Complete Load
    Dim objLoadCubeProcessInfo As LoadCubeProcessInfo = BRApi.Import.Process.LoadCube(si, currentWF)

    End If 'Not Completed
    Return selectionChangedTaskResult
    • RobbSalzmann's avatar
      RobbSalzmann
      Valued Contributor II

      Thanks MikeG .  Can you show the instantiation and initialization of wfStatus and currentWF please?

      I'm a bit confused by the BRApi call to set the status of the workflow to completed before running the steps below it?

      Is the line 
      "BRApi.Workflow.Status.SetWorkflowStatus(si, currentWF, StepClassificationTypes.Workspace, WorkflowStatusTypes.Completed, "Workspace Completed", "", "User clicked complete workflow", Guid.Empty)"
      the part that compels your workspace UI to update with the completed workflow?

      • MikeG's avatar
        MikeG
        Contributor III

        I created a Workspace that essentially is a summary of all the Workflow tasks I want to automate.  In your instance, you would not need to complete the 'Workspace' complete step, you could delete that or comment it out, and in your solution the first step in your Workflow to complete would be the 'Import' task/step.