How to run ondemand workflow over all pages

2019-08-02 19:29发布

问题:

I have to run an ondemand workflow over my custom entity,

lets say i have 1 million records, so how can i run this work flow over these records.

since, as far as i know we can only select the record and from ribbon click run workflow and specify it. In this way for max in single try, i can only select one page records and hence limited access

any idea?

回答1:

You cannot do that with the UI. The simplest approach would be with a small program which selects all records and trigger the workflow execution.

You could use the ExecuteWorkflowRequestfor this task.

// Create an ExecuteWorkflow request.
ExecuteWorkflowRequest request = new ExecuteWorkflowRequest()
{
    WorkflowId = <insert workflow id here>,
    EntityId = <insert record id here>
};

// Execute the workflow.
var response = (ExecuteWorkflowResponse)_serviceProxy.Execute(request);


回答2:

I use http://mscrmtoolkit.codeplex.com/documentation#workflowexecutionmanager for this purpose. Works fine.



回答3:

Actually you could run a workflow over all records out of the box, if you do it using the outlook client, via a pinned view. It's described in this blog post: http://www.powerobjects.com/blog/2013/07/30/run-on-demand-workflow-in-dynamics-crm-250-records/