Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Does ExecuteWorkflowRequest run synchronously when wf is configured synchronous?

(0) ShareShare
ReportReport
Posted on by 264

Hello,

Scenario is that I want to generate a document template from code, to save it in SharePoint. I am using predefined "SetWordTemplate" action. I tried first to use it directly via OrganizationRequest like described here: https://crmtipoftheday.com/608/generate-documents-in-code/ , but while testing, I discover that it is not synchronous, I was not able to reach the created note right after the execution every time.

However, it seems to be working with synchronous workflow which I start from code with ExecuteWorkflowRequest. I reach the note every time after that request. I tested in a loop, executed request 10 times, deleting note every time right after the request.

I would like to confirm if the behavior will be consistent in all environments, also when system is under a pressure.

Thanks in advance

*This post is locked for comments

  • Žarko Radevic Profile Picture
    Žarko Radevic 264 on at
    RE: Does ExecuteWorkflowRequest run synchronously when wf is configured synchronous?

    Hi, thanks for quick response. I verified the same with custom workflow activity simulating long running task before "SetWordTemplate" action.

  • Suggested answer
    Arpit Shrivastava Profile Picture
    Arpit Shrivastava 7,518 User Group Leader on at
    RE: Does ExecuteWorkflowRequest run synchronously when wf is configured synchronous?

    Hey Žarko,

    How workflow runs, it depends on the configuration you have done while creating the workflow. 

    ExecuteWorkflowRequest is just a call to trigger a particular workflow,

    As you said, your request is being called 10 times, this is due to your code is invoking ExecuteWorkflowRequest requests multiple times.

    Could you please tell, how you are running your code or on which event?

    -Arpit

  • Verified answer
    David Jennaway Profile Picture
    David Jennaway 14,063 on at
    RE: Does ExecuteWorkflowRequest run synchronously when wf is configured synchronous?

    Whether a workflow runs asynchronously is determined by the workflow configuration, and not how it is run (automatic, OnDemand via UI, ExecuteWorkflowRequest). So yes, if the workflow is a synchronous workflow, then it will run synchronously via ExecuteWorkflowRequest

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 Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans