If I create a Workflow from a template in code in Dynamics CRM, is it possible to change the values for the workflow step properties?
I have a custom workflow step, that is part of a workflow template, but for each workflow I create from this, I want to pass in different values to the step.
I'm creating the workflows from C# as part of a powershell cmdlet. I've tried creating the workflow from scratch with xaml but it's causing more problems that it solves.
I can create and retrieve the workflow with the following code, but I can't see anything to point me to the steps on the Workflow object I retrieve.
using (var proxy = auth.GetOrganizationProxy())
{
// This statement is required to enable early-bound type support.
proxy.EnableProxyTypes();
OrganizationServiceContext _orgContext = new OrganizationServiceContext(proxy);
CreateWorkflowFromTemplateRequest request = new CreateWorkflowFromTemplateRequest()
{
WorkflowName = "(" + EntityLogicalName + ") Migrate Notes to SharePoint",
WorkflowTemplateId = new Guid(ProcessTemplateId)
};
var response = (CreateWorkflowFromTemplateResponse)proxy.Execute(request);
ColumnSet cols = new ColumnSet(true);
Workflow newWorkflow = (Workflow)proxy.Retrieve(Workflow.EntityLogicalName, response.Id, cols);
newWorkflow.PrimaryEntity = EntityLogicalName;
}