web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

FetchXML to get all users with opportunity create privilege

(0) ShareShare
ReportReport
Posted on by 55,410 Moderator

Hi,

I am looking for a fetchXML to retrieve all/any user which has create privilege for opportunity entity. 

Would appreciate if someone can provide the same (My XRM toolbox is not working and manually building is too much :( ).

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Community Member Profile Picture
    on at

    Hi Ravi,

    use the following code:

    <fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>
        <entity name='privilege'>
            <link-entity name='roleprivileges' from='privilegeid' to='privilegeid' alias='p' link-type='inner' >
                <link-entity name='role' from='roleid' to='roleid' alias='rp' link-type='inner' >
                    <link-entity name='systemuserroles' from='roleid' to='roleid' alias='r' link-type='inner' >
                        <link-entity name='systemuser' from='systemuserid' to='systemuserid' alias='sr' link-type='inner' >
                            <attribute name='systemuserid' />
                            <attribute name='fullname' />
                        </link-entity> 
                    </link-entity> 
                </link-entity> 
            </link-entity> 
            <filter type='and'>
                <condition attribute='name' operator='eq' value='prvCreateOpportunity' />
            </filter>
        </entity>
    </fetch>

    Please let me know if you solve.

    If you found the answer helpful, please mark as Verified 

    Join my network on LinkedIn      Follow me on Twitter 

    Thank You & Best Regards

    Francesco Picchi

    Microsoft Dynamics CRM Consultant, Bologna+Milano, ITALY

    Independent Contractor

    http://www.francescopicchi.com

  • RaviKashyap Profile Picture
    55,410 Moderator on at

    Thanks Francesco.

    This worked. Thanks for your help.

  • naZir Profile Picture
    850 on at

    Hi Sir,

    Can you please tell me. how did you build that query

  • Verified answer
    RaviKashyap Profile Picture
    55,410 Moderator on at

    Hi Francesco.

    I had to get the entity reference of the System User entity so I changed it as below. This is returning the correct records but let me know if you see any issues or thoughts.

    -----------------------------

    <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true" >

       <entity name="systemuser" >

           <attribute name="systemuserid" />

           <attribute name="fullname" />

           <link-entity name="systemuserroles" from="systemuserid" to="systemuserid" alias="r" link-type="inner" >

               <link-entity name="role" from="roleid" to="roleid" alias="rp" link-type="inner" >

                   <link-entity name="roleprivileges" from="roleid" to="roleid" alias="p" link-type="inner" >

                       <link-entity name="privilege" from="privilegeid" to="privilegeid" alias="sr" link-type="inner" >

                           <filter type="and" >

                               <condition attribute="name" operator="eq" value="prvCreateOpportunity" />

                           </filter>

                       </link-entity>

                   </link-entity>

               </link-entity>

           </link-entity>

           <filter type="and" >

               <condition attribute="domainname" operator="eq" value="rahul@testorgnov.onmicrosoft.com" />

               <condition attribute="accessmode" operator="ne" value="1" />

               <condition attribute="isdisabled" operator="eq" value="0" />

           </filter>

       </entity>

    </fetch>

    ------------------------------

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans