Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

workflow from console app for multiple records ?

Posted on by Microsoft Employee

a console app will use ExecuteWorkflowRequest and run on demand workflow.

ExecuteWorkflowRequest works with a single record. Please tell me how to run it without
passing EntityId.

I want to process multiple records with it so have not one EntityId.

How to avoid passing EntityId ?

ExecuteWorkflowRequest request = new ExecuteWorkflowRequest()
{
    WorkflowId = _workflowId,
    EntityId = _leadId
};


Guide me please.

Thanks

*This post is locked for comments

  • Suggested answer
    Michel Gueli Profile Picture
    Michel Gueli 982 on at
    RE: workflow from console app for multiple records ?

    var query = new QueryExpression("contact");

    var result = service.RetrieveMultiple(query);

    foreach(var e in result.Entities)
    {

    ExecuteWorkflowRequest request = new ExecuteWorkflowRequest()
    {
        WorkflowId = _workflowId,
        EntityId = e.Id;
    };

    }

  • Suggested answer
    Rawish Kumar Profile Picture
    Rawish Kumar 13,756 on at
    RE: workflow from console app for multiple records ?

    Hi Maoun,

    You can retrieve the entity collection based on your criteria using queryexpression.

    have a look on the below :

    www.magnetismsolutions.com/.../programmatically_fire_a_workflow_in_dynamics_crm_2011

  • Verified answer
    Alex Fun Wei Jie Profile Picture
    Alex Fun Wei Jie 33,626 on at
    RE: workflow from console app for multiple records ?

    Hi,

    in order to execute workflow via calling ExecuteWorkflowRequest, You need to pass in the workflow id and the record id, there is no way to do it without both .

    you can specify a condition and retrieve the record id via below method.

    msdn.microsoft.com/.../gg328332.aspx

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans