CreateWorkflowFromTemplateRequest Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Contains the data that is needed to create a workflow (process) from a workflow template.
public ref class CreateWorkflowFromTemplateRequest sealed : Microsoft::Xrm::Sdk::OrganizationRequest
[System.Runtime.Serialization.DataContract(Namespace="http://schemas.microsoft.com/crm/2011/Contracts")]
public sealed class CreateWorkflowFromTemplateRequest : Microsoft.Xrm.Sdk.OrganizationRequest
[<System.Runtime.Serialization.DataContract(Namespace="http://schemas.microsoft.com/crm/2011/Contracts")>]
type CreateWorkflowFromTemplateRequest = class
inherit OrganizationRequest
Public NotInheritable Class CreateWorkflowFromTemplateRequest
Inherits OrganizationRequest
- Inheritance
- Attributes
Examples
The following example shows how to use this message. For this sample to work correctly, you must be connected to the server to get an IOrganizationService interface instance. For the complete sample, see the link later in this topic.
/// <summary>
/// Demonstrates how to create a workflow record from a workflow template
/// </summary>
/// <param name="service">The authenticated IOrganizationService instance.</param>
/// <param name="processTemplateId">The ID of the template workflow</param>
static void CreateWorkflowFromTemplate(IOrganizationService service, Guid processTemplateId)
{
CreateWorkflowFromTemplateRequest request = new ()
{
WorkflowName = "Workflow From Template",
WorkflowTemplateId = processTemplateId
};
// Execute request.
var response = (CreateWorkflowFromTemplateResponse)service.Execute(request);
// Verify success.
// Retrieve the name of the workflow.
ColumnSet cols = new ("name");
Entity newWorkflow = service.Retrieve("workflow", response.Id, cols);
if (newWorkflow["name"] == "Workflow From Template")
{
Console.WriteLine($"Created {request.WorkflowName}.");
}
}
For more code samples using workflow, see Sample: Workflow operations
Remarks
For the Web API use the CreateWorkflowFromTemplate action.
Usage
Pass an instance of this class to the Execute(OrganizationRequest) method, which returns an instance of CreateWorkflowFromTemplateResponse.
Privileges and Access Rights
To perform this action, the caller must have privileges on the workflow entity and access rights on the record specified in the WorkflowTemplateId property. The prvCreateWorkflow
and prvReadWorkflow
privileges are required.
Constructors
CreateWorkflowFromTemplateRequest() |
Initializes a new instance of the |
Properties
ExtensionData |
Gets or sets the structure that contains extra data. Optional. (Inherited from OrganizationRequest) |
Item[String] |
Gets or sets the indexer for the |
Parameters |
Gets or sets the collection of parameters for the request. Required, but is supplied by derived classes. (Inherited from OrganizationRequest) |
RequestId |
Gets or sets the ID of the request. Optional. (Inherited from OrganizationRequest) |
RequestName |
Gets or sets the name of the request. Required, but is supplied by derived classes. (Inherited from OrganizationRequest) |
WorkflowName |
Gets or sets the name of the new workflow. Required. |
WorkflowTemplateId |
Gets or sets the ID of the workflow template. Required. |