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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Answered

getting a user's business unit on the basis of email address

(0) ShareShare
ReportReport
Posted on by 60

I have been able to get the currently logged-in user's business unit value on the basis of the system user id. I want to get the same business unit value but, on the basis of the "internalemailaddress" or simply the user's email address. 

Till now, I have been able to get the current user's email address. But, don't know how to get the business unit value on the basis of it. 

Is it possible to retrieve a user's business unit on the basis of the email address of the user?

I have the same question (0)
  • Verified answer
    HSS2482 Profile Picture
    105 on at

    You can get the value using this fetch:

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

     <entity name="businessunit">

       <attribute name="name" />

       <attribute name="address1_telephone1" />

       <attribute name="websiteurl" />

       <attribute name="parentbusinessunitid" />

       <attribute name="businessunitid" />

       <order attribute="name" descending="false" />

       <link-entity name="systemuser" from="businessunitid" to="businessunitid" link-type="inner" alias="ac">

         <filter type="and">

           <condition attribute="internalemailaddress" operator="eq" value="Put your email id here" />

         </filter>

       </link-entity>

     </entity>

    </fetch>

    pastedimage1658495547823v1.png

  • restassured Profile Picture
    60 on at

     HSS2482 Thanks for the reply. I tried running the above fetch code but, it is not returning the business unit id of the user. It is basically returning the unique identifier of the field business unit. I want to see the id of the business unit to which the current user belongs. Do I have to make some changes in the above fetch code?

  • Suggested answer
    HSS2482 Profile Picture
    105 on at

    This should return the BU of the user whose Primary Email id is passed in fetch.

    Can you share how you are forming this and passing the email id value.

    pastedimage1658769104503v1.png

  • restassured Profile Picture
    60 on at

    HSS2482  Actually, it was a fault in my query. I was searching for the wrong user's mail. I have one question. Can you please tell me how can I make the email address of the user dynamic inside the fetchXML code? I will get the mail of the currently logged-in user and then perform the above query to get its business unit.

  • HSS2482 Profile Picture
    105 on at

    Hi

    How are you calling this fetch? Javascript or c# code?

    Can you share how exactly you are trying to fetch this so that we can suggest appropriate approach.

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Subra Profile Picture

Subra 118

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 89 Super User 2026 Season 1

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 85 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans