Simultaneously completed all WF forms for descendants.

Stulai
New Contributor II

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 

 

1 ACCEPTED SOLUTION

JackLacava
Community Manager
Community Manager

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...

View solution in original post

4 REPLIES 4

JackLacava
Community Manager
Community Manager
' 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

 

Stulai
New Contributor II

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?

image.png

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

Next
Next
 
Dim selectionResult As New XFSelectionChangedTaskResult()
selectionResult.WorkflowWasChangedbyBusinessRule = True
Return selectionResult
 
Catch ex As Exception
Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
End Try
#End Region

JackLacava
Community Manager
Community Manager

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...

vignesh
New Contributor II

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?

https://community.onestreamsoftware.com/t5/Workflow-and-Data-Integration/Security-Access-Error-Unabl...

vignesh_0-1712644310565.png

 

Thanks, Vignesh

Please sign in! Stulai