SubmitTaskAction


Description

This method submits a workflow action to be performed on a document or collection of documents.

Parameters

Parameter

Type

Description

submissions

ArrayOfTaskActionSubmissionInformation

The collection of documents that will have a workflow action performed for them.

organizationKey

OrganizationKey

Specifies the unique identifier of the company that contains the documents being processed.


Return Value:

Value

Type

Description

SubmitTaskActionResult

ArrayOfTaskActionSubmissionResult

The results of the submission.


Examples

The following C# example retrieves all of the incomplete tasks for the current user. If a task indicates that it should be approved, it is added to the collection of documents to be approved.

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;
			WorkflowTask[] tasks;
			TaskActionSubmissionInformation[] submissionInfo;
			TaskActionSubmissionResult[] submissionResult;

			// Create an instance of the web service
			ynamicsWorkflow 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);

			// Get tasks for this user
			tasks = wsWorkflow.GetTasksForCurrentUser(companyKey, false);

			// Look through the list of tasks, and approve any documents
			Int16 length = (Int16)tasks.GetLength(0);
			submissionInfo = new TaskActionSubmissionInformation[length];
			for (Int16 i = 0; i < length; i++ )
			{
				// Is this a document to approve?
				if (tasks[i].Description.Contains("approval") == true)
				{
					// Create the SubmissionInfo object for the task
					submissionInfo[i] = new TaskActionSubmissionInformation();

					// Set the characteristics of the task
					submissionInfo[i].WorkflowName = "Dynamics GP " + tasks[i].WorkflowName + " Workflow";
					submissionInfo[i].TaskId = tasks[i].Id;
					submissionInfo[i].DueDays = 0;
					submissionInfo[i].OriginalDueDays = 0;

					// Add a comment
					submissionInfo[i].Comment = "Batch approved";

					// Approve the task
					submissionInfo[i].TaskDisposition = TaskDisposition.Approve;
			}
		}

			// Submit the task operations
			submissionResult = wsWorkflow.SubmitTaskAction(submissionInfo, companyKey);

			// Look at the submission results
			foreach (TaskActionSubmissionResult r in submissionResult)
			{
				MessageBox.Show(r.ExceptionInformation.Message);
		}
	}
}
}


Documentation Feedback