07-22-2024 04:16 AM
Hi All,
We have multiple Profiles under a workflow and each profile contains multiple forms in it. While executing the business rule through the button from workflow dashboard, It is just completing that particular workflow with forms but not the other workflows which consists of multiple forms.
Below is the code using to complete the workflow. Is there a solution for this issue.
Dim selectionChangedTaskResult As New XFSelectionChangedTaskResult()
Dim wfProfile As String = BRApi.Workflow.Metadata.GetProfile(si, si.WorkflowClusterPk.ProfileKey).Name
Dim scenario As String = ScenarioDimHelper.GetNameFromID(si, si.WorkflowClusterPk.ScenarioKey)
Dim time As String = BRApi.Finance.Time.GetNameFromId(si, si.WorkflowClusterPk.TimeKey)
Dim wfClusterPK As WorkflowUnitClusterPk = BRApi.Workflow.General.GetWorkflowUnitClusterPk(si, wfProfile, scenario, time)
BRApi.Workflow.Status.SetWorkflowStatus(si,wfClusterPK, StepClassificationTypes.Certify, WorkflowStatusTypes.Completed, "Auto completing Forms","Error autocompleting Forms", "Auto completing", Nothing)
selectionChangedTaskResult.WorkflowWasChangedByBusinessRule = True
selectionChangedTaskResult.IsOK = True
selectionChangedTaskResult.ShowMessageBox = True
Return selectionChangedTaskResult
07-29-2024 05:44 PM - edited 07-29-2024 05:45 PM
I think you would need to get each workflow cluster PK for all child workflows and then set the status for each one. You are only referencing the current workflow through si.WorkflowClusterPk.ProfileKey so that is the one that is completing. I have not used this but there is a BRAPI call BRApi.Workflow.Metadata.GetRelatives which could get all the base input workflows and then you can loop through them and set the status. If that doesn't work, you may have to pull each one individually using the hardcoded name of each one.