GetPossibleDelegates


Description

This method retrieves the list of users to whom the workflow task could be delegated for the specified workflow and list of users.

Parameters

Parameter

Type

Description

associationKey

WorkflowAssociationKey

The workflow association key that specifies the workflow being examined.

taskOwners

ArrayOfString

A list of the users for whom delegates are being retrieved.


Return Value:

Value

Type

Description

GetPossibleDelegatesResult

ArrayOfUser

The list of users to whom the workflow task could be delegated.


Examples

The following C# example retrieves the list of possible delegates for the Dynamics GP Sales Quote Approval Workflow set up for the sample company. Possible delegates for the user “CORPORATE\bclark” are retrieved. The list of delegates is displayed in a dialog.

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;
			User[] delegates;

			// 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);

			// Get the list of possible delegates for a workflow
			workflowKey = new WorkflowAssociationKey();
			workflowKey.OrganizationKey = companyKey;
			workflowKey.WorkflowName = "Dynamics GP Sales Quote Approval Workflow";

			// Get delegates for this user
			string[] users = { "CORPORATE\\bclark" };

			// Get the list of possible delegates
			delegates = wsWorkflow.GetPossibleDelegates(workflowKey, users);

			// Display the list of delegates for the workflow
			StringBuilder delegateList = new StringBuilder();
			foreach (User u in delegates)
			{
				delegateList.AppendLine(u.LogOnName + " -- " + u.DisplayName);
		}
			MessageBox.Show(delegateList.ToString());
	}
}
}


Documentation Feedback