This method will find out whether a specific workflow type is enabled for a company.
Parameter |
Type |
Description |
---|---|---|
associationKey |
The workflow association key that specifies the workflow being examined. |
Value |
Type |
Description |
---|---|---|
IsWorkflowEnabledResult |
The value true indicates the workflow is enabled, while false indicates it is not. |
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(); } } }