Hi,
I have gotten an error when i triggered workflow transition in a vbs macro. I think WorkflowEngine.WorkflowTransitionTrigger method retuns empty value (Set workflowTransitionTrigger = oRoot.WorkflowEngine.workflowTransitionTrigger(mgobjWorkflowInstance)) .
Below my screenshot and full script;
Full macro;
Sub MainRoot(megaRoot)
Dim root
Set root = megaRoot
Dim process
Set process = root.GetObjectFromID("YXOxDv(OXjtS")
Dim user
Set user = root.GetObjectFromID("Y)5pEoSQGn4M")
Dim publishedId
publishedId = "63nRUR7ZTT(8"
Dim published
Set published = root.GetObjectFromID(publishedId)
Dim returnedId
returnedId = "KeoejEgFTzK3"
Dim returned
Set returned = root.GetObjectFromID(returnedId)
MsgBox("Start")
MsgBox("Result: " & TriggerTransition(root, process, user, returned, returned.megafield))
MsgBox("Finish")
End Sub
Function TriggerTransition(oRoot, oSubject, oPerson, oTransition, oTransitionId)
TriggerTransition = False
Dim mgcolWorkflowInstance
Dim mgobjWorkflowInstance
Dim mgobjParameter
Set mgobjParameter = oRoot.WorkflowEngine.NewParameter
mgobjParameter.setPropertyObject "~k3gIKMrvEXi7[Subject Identifier]", oSubject
mgobjParameter.setPropertyObject "~rOZRrAe9FzfH[User Identifier]", oPerson
mgobjParameter.setProperty "~iL7YbFARFLxT[Workflow Status Instance Identifier]", oTransitionId
Set mgcolWorkflowInstance = oRoot.WorkflowEngine.GetWorkflowInstances(mgobjParameter)
Set mgobjWorkflowInstance = mgcolWorkflowInstance.Item(1)
Set mgcolWorkflowInstance = Nothing
If mgobjWorkflowInstance.Exists Then
Dim mgcolNextTransitions
mgcolNextTransitions = mgobjWorkflowInstance.getCollection("Workflow Next Transition Description")
Set workflowTransitionTrigger = oRoot.WorkflowEngine.workflowTransitionTrigger(mgobjWorkflowInstance)
workflowTransitionTrigger.SetBatchMode = True
Set mgobjWorkflowInstance = workflowTransitionTrigger.triggerTransition(oTransition)
Dim mgobjWorkflowResult
TriggerTransition = workflowTransitionTrigger.GetResult().isSucces()
End If
Set mgcolWorkflowInstance = Nothing
Set mgobjWorkflowInstance = Nothing
Set mgobjParameter = Nothing
End Function