You are here

You are here

Initiating Workflows

There are 2 methods for initiating a workflow from the API: BPMInitiateWorkflow  and BPMInitiateWorkflowWithDocuments that allow you to start a SpringCM workflow with either custom XML or a set of SpringCM documents respectively.  Both methods require the name of the workflow to start which should match the name of a workflow definition in the SpringCM user interface in the account.

When calling BPMInitiateWorkflow the data parameter is a string that must be valid XML.  XML should be kept simple and if possible, not include XML namespaces.   BPMInitiateWorkflowWithDocuments takes an array of one or more SpringCM document Id's used to initiate the workflow.  

Vertical Tabs

c#
//Find a document by its path and then start the workflow with its doument Id
SCMPath path = springCMService.ParsePath(token, "", "/Customers/Company ABC/ContractQ1.pdf", false);
string[] documents = new string[]{path.Document.Id};
string workflowId = springCMService.BPMInitiateWorkflowWithDocuments(token, "Approve Contract", documents);
 
//Create custom XML and use it to initiate a workflow
//In this example, the workflow could be developed find a document by path
//and update it with an Id from an external system
string workflowXML = "<Workflow><DocumentPath>/Customers/Company ABC/ContractQ1.pdf</DocumentPath><SourceSystemId>AGHR7UTY</SourceSystemId></Workflow>";
string workflowId = springCMService.BPMInitiateWorkflow(token, "Update Document Source System Id", workflowXML);
java
//Find a document by its path and then start the workflow with its doument Id
SCMPath path = springCMService.parsePath(token, "", "/Customers/Company ABC/ContractQ1.pdf", false);
String[] documents = new String[]{path.getDocument().getId()};
String workflowId = springCMService.BPMInitiateWorkflowWithDocuments(token, "Approve Contract", documents);
 
//Create custom XML and use it to initiate a workflow
//In this example, the workflow could be developed find a document by path
//and update it with an Id from an external system
String workflowXML = "<Workflow><DocumentPath>/Customers/Company ABC/ContractQ1.pdf</DocumentPath><SourceSystemId>AGHR7UTY</SourceSystemId></Workflow>";
String workflowId = springCMService.BPMInitiateWorkflow(token, "Update Document Source System Id", workflowXML);