10-04-2023 10:57 AM
Hello Everybody,
Could you please help to get a solution how to complete all WF forms at once for all descendants. We already got the extensibility rule for this purpose but it's completing all WF steps except forms. The function for form exists (brapi.Forms.Process.ExecuteCompleteForm(si, formPk)), but we are having trouble retrieving the formPk...
Would be highly grateful if someone can share an idea how to solve this.
Best Regards,
Svetlana
Solved! Go to Solution.
10-06-2023 09:53 AM
Yeah sorry, the actual lists of forms are one level deeper, just change the For line adding .RequiredForms:
For each formObj as XFFormSummaryInfo in objXFFormsForWorkflow.RequiredForms
Intellisense is your friend...
10-05-2023 09:44 AM
' get all forms in the currently-selected Worflow cluster (wf/scenario/time combination)
Dim objXFFormsForWorkflow As XFFormsForWorkflow = BRApi.Forms.Metadata.GetForms(si, si.WorkflowClusterPk)
' for each form
For each formObj as XFFormSummaryInfo in objXFFormsForWorkflow
' retrieve the XFFormPk
Dim objXFFormPk As XFFormPk = objXFFormSummaryInfo.FormPk
' ... your hacks here
Next
10-06-2023 03:36 AM
Dear Jack,
I truly appreciate your response and it looks like we are very close to finding the correct way to fill out all the forms, but we keep getting the following error, do you have any idea what is wrong with the below code?
Our Extensibility Rule looks like this:
#Region "Complete Workflow"
For Each WFStep As String In WFEntities
For Each WFProc As String In WFProcess
Dim WorkFlowStep As String = WFStep & "." & WFProc
Dim WFInfo As WorkFlowProfileInfo = BRApi.Workflow.Metadata.GetProfile(si, WorkFlowStep) 'create loop
Dim WFCluster As New WorkflowUnitClusterPk(WFInfo.ProfileKey,si.WorkflowClusterPk.ScenarioKey, si.WorkflowClusterPk.TimeKey)
Dim WfStatus As WorkflowInfo = BRApi.Workflow.Status.getworkflowstatus(si, wfcluster, False)
Select Case WfStatus.name
Case Is = "Form Input, Process, Confirm"
' get all forms in the currently-selected Worflow cluster (wf/scenario/time combination)
Dim objXFFormsForWorkflow As XFFormsForWorkflow = BRApi.Forms.Metadata.GetForms(si, WFCluster)
' for each form
For Each formObj As XFFormSummaryInfo In objXFFormsForWorkflow
' retrieve the XFFormPk
Dim objXFFormPk As XFFormPk = formObj.FormPk
brapi.Forms.Process.ExecuteCompleteForm(si, objXFFormPk)
Next
brapi.Forms.Process.ExecuteUpdateFormWorkflow(si, WFCluster, True)
brapi.DataQuality.Process.ExecuteProcessCube(si, WFCluster, StepClassificationTypes.ProcessCube, False)
brapi.DataQuality.Process.ExecuteConfirmation(si, WFCluster)
'Case Is = "Import, Validate, Load"
Case Is = "Workspace"
BRApi.Workflow.Status.SetWorkflowStatus(si, si.WorkflowClusterPk, StepClassificationTypes.Workspace, WorkflowStatusTypes.Completed, StringHelper.FormatMessage("", ""), "", "", Guid.Empty)
' Case Is = "ZZZ"
End Select
10-06-2023 09:53 AM
Yeah sorry, the actual lists of forms are one level deeper, just change the For line adding .RequiredForms:
For each formObj as XFFormSummaryInfo in objXFFormsForWorkflow.RequiredForms
Intellisense is your friend...
04-09-2024 02:32 AM
Hello,
When i try to execute the code i am getting the following error. i looked for solution in the community but it doesn't have any resolution, can you please help with this?
Thanks, Vignesh
a week ago
@JackLacava / @Stulai ,
Can you help me with the declare of the WFProcess and WFStep?
We try to implement this rule our self but we cannot get the script into the "for each" loop.
Thanks in advance.
"For Each WFStep As String In WFEntities
For Each WFProc As String In WFProcess"
Thursday - last edited Thursday
You know Workflow names, they look like "MyProfile.Import", right? That's what they are building in the line that goes Dim WorkFlowStep As String = WFStep & "." & WFProc - WFStep would be "MyProfile" and WFProc would be "Import".
Now, in this case, they are populating WFStep with each string contained in a list called WFEntities, and WFProc with each string contained in a list called WFProcess. So before all this code, they probably have something like:
Dim WFEntities as New List(Of String)
WFEntities.Add("MyProfile")
WFEntities.Add("SomeOtherProfile") ' etc etc
Dim WFProcess as New List(Of String)
WFEntities.Add("Import")
WFEntities.Add("Forms") ' etc etc
Does that make sense ?
Looking at the name of their variables, they've probably used Entity names when naming their Profiles.