06-06-2023 02:48 PM - edited 06-07-2023 01:03 PM
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.
06-07-2023 08:21 AM - edited 06-07-2023 08:22 AM
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
06-07-2023 09:06 AM - edited 06-07-2023 10:19 AM
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
06-07-2023 10:31 AM
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:
06-07-2023 10:39 AM - edited 06-07-2023 10:43 AM
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?
06-07-2023 10:52 AM
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.
06-07-2023 11:05 AM
@MikeG what I'm looking for is how to compel the UI to show that the steps are complete, without having to click the refresh button. Can you isolate your suggestion to just the line that does this please?
06-07-2023 11:17 AM
@NicolasArgente was close. I'm not certain on the exact line of code. There is not a specific API to refresh the application, that is controlled and/or locked down by the platform. But, my Workspace is indeed updating the Workflow statuses and showing the green check marks in my WFPOV.
06-07-2023 12:20 PM
@MikeG thanks for the help!