IsWorkflowEnabled


Description

This method will find out whether a specific workflow type is enabled for a company.

Parameters

Parameter

Type

Description

associationKey

WorkflowAssociationKey

The workflow association key that specifies the workflow being examined.


Return Value:

Value

Type

Description

IsWorkflowEnabledResult

boolean

The value true indicates the workflow is enabled, while false indicates it is not.


Examples

The following C# example retrieves the state of the Dynamics GP General Ledger Batch Approval Workflow for the sample company and writes the result to the console window.

Be sure to use the URL and port for your workflow server.


using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Dynamics.Workflow.Proxy;

namespace WorkflowWebServiceSample
{
	class Program
	{
		static void Main(string[] args)
		{
			CompanyKey companyKey;
			WorkflowAssociationKey workflowKey;
			bool leadWorkflowEnabled;

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

			// Is the workflow enabled?
			workflowKey = new WorkflowAssociationKey();
			workflowKey.OrganizationKey = companyKey;
			workflowKey.WorkflowName = "Dynamics GP General Ledger Batch Approval Workflow";
			leadWorkflowEnabled = wsWorkflow.IsWorkflowEnabled(workflowKey);
			Console.WriteLine("General Ledger Batch Approval Workflow Enabled: " +
			leadWorkflowEnabled.ToString()); 
			Console.ReadLine();
	}
}
}

Documentation Feedback