Does anyone have any experience using CreateWorkflowFromModelId method on the nms:operation schema?
I've tried to call it using a valid workflow template, but every time it returns "0" for the plWorkflowId, and there is no workflow object being created. I use SOAPUI to make the call using the nms:operation schema WSDL.
I've also tried adding an operationPlanning element in <urn:elemOperationPlanning>, but this also returns the same result.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:nms:operation">
<SOAP-ENV:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns="urn:nms:operation" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<CreateWorkflowFromModelIdResponse SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns="urn:nms:operation">
I have solved this using the CreateInstanceFromModel method on xtk:queryDef. Here is the sample XML I used to create a workflow from a template, and then associate ("patch") the workflow to a campaign object:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:xtk:queryDef">
<workflow label="Email workflow" operation-id="9876"/>
I used the same request that you've used. It works! You need to link the campaign id to the workflow template. However, I was able to create only one workflow in the campaign using this api call. If I try to execute the same api call again, that didn't work.
Try the below. That should work.
Thanks, but I'm not sure I follow
You had to manually update the workflow template with the campaign id? And then when you executed the CreateWorkflowFromModelId method it automatically assigned a new workflow to that specific campaign?
I could not replicate this behavior. Also, I want to be able to create a new workflow from a template for any campaign, not one specifically assigned to a campaign object.
Do you know of any other way to create workflows from a template and assign to any campaign? Other than Spawn (+ derivatives) or CreateWorkflowFromModelId? There must be a way or it wouldn't be possible through the console either.
Thanks for the reply. I have tried the xtk:workflow Spawn method, however whilst this creates a new workflow from a template, it also starts the workflow. I could set the workflow template up to have a disabled start activity, and this does work, however it also creates workflow logs which seems to be a bit of a hack.
Ideally, I want to replicate the functionality of the console, where a new workflow can be automatically associated to a campaign: