Export (0) Print
Expand All
Expand Minimize

CreateWorkflowFromTemplate Message (CrmService)

banner art

[Applies to: Microsoft Dynamics CRM 4.0]

Works for all deployment typesWorks online only

Creates a workflow from a workflow template.

The relevant classes are specified in the following table.

TypeClass
RequestCreateWorkflowFromTemplateRequest
ResponseCreateWorkflowFromTemplateResponse
Entityworkflow

Remarks

To use this message, pass an instance of the CreateWorkflowFromTemplateRequest class as the request parameter in the Execute method.

To perform this action, the caller must have access rights on the workflow entity instance. For a list of required privileges, see CreateWorkflowFromTemplate Privileges.

Example

The following code example shows how to use the CreateWorkflowFromTemplate message.

[C#]
// Set up the CRM Service.
CrmAuthenticationToken token = new CrmAuthenticationToken();
// You can use enums.cs from the SDK\Helpers folder to get the enumeration for Active Directory authentication.
token.AuthenticationType = 0; 
token.OrganizationName = "AdventureWorksCycle";
 
CrmService service = new CrmService();
service.Url = "http://<servername>:<port>/mscrmservices/2007/crmservice.asmx";
service.CrmAuthenticationTokenValue = token;
service.Credentials = System.Net.CredentialCache.DefaultCredentials;

// Create a WorkflowFromTemplate request.
CreateWorkflowFromTemplateRequest request = new CreateWorkflowFromTemplateRequest();
request.WorkflowName = "Workflow From Template";
request.WorkflowTemplateId = new Guid("C15AF217-C17E-DA11-B90F-000874DE7397");

// Execute the request.
CreateWorkflowFromTemplateResponse response = (CreateWorkflowFromTemplateResponse)service.Execute(request);
[Visual Basic .NET]
' Set up the CRM Service.
Dim token As New CrmAuthenticationToken()
' You can use enums.cs from the SDK\Helpers folder to get the enumeration for Active Directory authentication.
token.AuthenticationType = 0
token.OrganizationName = "AdventureWorksCycle";
 
Dim service As New CrmService()
service.Url = "http://<servername>:<port>/mscrmservices/2007/crmservice.asmx";
service.CrmAuthenticationTokenValue = token;
service.Credentials = System.Net.CredentialCache.DefaultCredentials

' Create a WorkflowFromTemplate request.
Dim request As New CreateWorkflowFromTemplateRequest()
request.WorkflowName = "Workflow From Template"
request.WorkflowTemplateId = New Guid("C15AF217-C17E-DA11-B90F-000874DE7397")

' Execute request
Dim response As CreateWorkflowFromTemplateResponse = CType(service.Execute(request), CreateWorkflowFromTemplateResponse)

See Also

Concepts

Reference


© 2010 Microsoft Corporation. All rights reserved.


Show:
© 2014 Microsoft