This method submits a document or collection of documents to workflow.
Parameter |
Type |
Description |
---|---|---|
submissions |
The collection of documents to submit to workflow. |
|
organizationKey |
Specifies the unique identifier of the company for which documents are being submitted to workflow. |
Value |
Type |
Description |
---|---|---|
SubmitForApprovalResult |
The results of the submission. |
The following C# example submits the Sales Quote document with the document number “QTEST1035” to the Dynamics GP Sales Quote Approval Workflow set up for the sample company.
Be sure to use the URL and port for your workflow server. |
using System; using System.Collections.Generic; using System.Text; using System.Windows.Forms; using Microsoft.Dynamics.Workflow.Proxy; namespace WorkflowWebServiceSample { class Program { static void Main(string[] args) { CompanyKey companyKey; WorkflowAssociationKey workflowKey; BusinessObjectKey key; KeyPart[] keyParts; KeyPartOfString docNumber; KeyPartOfString docType; BusinessObjectSubmissionInformation[] submissionInfo; BusinessObjectSubmissionInformation docToSubmit; // Create an instance of the web service DynamicsWorkflow wsWorkflow = new DynamicsWorkflow(); // Specify the URL used to access the Workflow web service wsWorkflow.Url = "http://WorkflowServer:10072/_vti_bin/WorkflowService.asmx"; // Be sure that default credentials are being used wsWorkflow.UseDefaultCredentials = true; // Create the company key for the sample company companyKey = new CompanyKey(); companyKey.Id = (-1); // Specify the workflow workflowKey = new WorkflowAssociationKey(); workflowKey.OrganizationKey = companyKey; workflowKey.WorkflowName = "Dynamics GP Sales Quote Approval Workflow"; // Specify which SOP Quote document is being submitted key = new BusinessObjectKey(); // Build the key parts // Document number docNumber = new KeyPartOfString(); docNumber.Name = "SOPNUMBE"; docNumber.PartValue = "QTEST1035"; // Document type docType = new KeyPartOfString(); docType.Name = "SOPTYPE"; docType.PartValue = "Quote"; // Assemble the key parts keyParts = new KeyPart[2]; keyParts[0] = docNumber; keyParts[1] = docType; // Add the key parts to the key key.KeyParts = keyParts; // Create the information to submit submissionInfo = new BusinessObjectSubmissionInformation[1]; // Document to submit docToSubmit = new BusinessObjectSubmissionInformation(); docToSubmit.BusinessObjectKey = key; docToSubmit.Comment = "Submitted through web service"; docToSubmit.WorkflowName = "Dynamics GP Sales Quote Approval Workflow"; // Add the document to the array submissionInfo[0] = docToSubmit; // Submit the document to workflow wsWorkflow.SubmitForApproval(submissionInfo, companyKey); } } }