Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Answered

Can someone explain workflow scope and execute as please

Posted on by 130

Dear Dynamics Community,

I've been working with Dynamics for some time and not experienced this issue before, but it would be great if someone could just confirm (or deny) my assumptions. For this example I'm looking at a real-time workflow that is triggered by a field change. 

My understanding of the Scope is this:

User - workflow will only run on the records owned by the owner of the workflow
Business Unit - workflow will only run for records owned by the owner of the workflow or other owners (users or teams) within the workflow owner's business unit
Parent: Child Business Units - workflow will only run for records owned by the owner of the workflow or other owners (users or teams) within the workflow owner's business unit or child business units
Organization: workflow will run on all records

I've tested all of this and it works. The challenge I have is when using Execute As; if I set Execute As to 'The user that made changes to the record', along with scope 'User' my assumption is that the workflow would run on any records that are owned by the person that triggered the workflow (in this case made a change to the trigger field on the specific entity/table the workflow was set up on) rather than just records owned by the owner of the workflow itself, but it doesn't - it still only works on records owned by the owner of the workflow. 

My tests: 

Workflow is real-time, has a Start After trigger for one field, Scope is 'User' and Execute As is 'The user that made changes to the record'

  1. Changing ownership of the workflow to the same user who triggers the workflow (field change) = workflow runs
  2. Changing the ownership of the workflow to a different user from the user who triggers the workflow (field change) = workflow does not run
  3. Setting the workflow to also run on-demand, with the owner of the workflow different to the triggering user of the workflow = workflow runs when on-demand is used (not when triggered)

I should say that this isn't a huge problem at the the moment because running the workflow with 'Organization' Scope will not cause any security issues, I just thought I knew this stuff and my (apparently tiny) brain is struggling to understand. If anyone can explain it simply, please do help! 

My assumption from testing is this:

Scope indicates which set of records the workflow will run on and for automated (i.e. triggered) workflows this is defined by the owner of the workflow. For on-demand workflows the process will take the scope of the person that called the on-demand workflow, not the owner of the workflow. 

Kindest regards,

Matt

  • MattTaylor Profile Picture
    MattTaylor 130 on at
    RE: Can someone explain workflow scope and execute as please

    Thanks for replying, Bipin.

    It's good to have someone just confirm it.

    Kind regards,

    Matt

  • Verified answer
    Bipin D365 Profile Picture
    Bipin D365 28,964 Super User 2024 Season 1 on at
    RE: Can someone explain workflow scope and execute as please

    Hi,

    When you set Scope to User -> workflow will only run on the records owned by the owner of the workflow

    This still holds true, Now when you set Execute as to 'User who made the changes'

    Any logic which gets executed in workflow will run under the user who is causing the workflow to trigger. You can confirm this by checking the Created by field when you create any record from workflow/Modified by field when you are updating the record.

    So your understanding is correct.

    Please mark my answer verified if this is helpful!

    Regards,

    Bipin Kumar

    Follow my Blog: xrmdynamicscrm.wordpress.com/

  • MattTaylor Profile Picture
    MattTaylor 130 on at
    RE: Can someone explain workflow scope and execute as please

    Having slept on this, I've come to the following conclusion:

    Scope
    This refers to the records that the trigger (e.g. after field update) will run on

    Execute As
    Once the workflow has been triggered, this is the permission levels that the workflow will run with

    Can anyone confirm or correct?

    Kind regards,

    Matt

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,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans