Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM forum
Unanswered

Unable to retrieve alias value for "businessunitid" from systemusers

Posted on by 60

This code is joining incident & systemusers entity.


//link users

                        queryIncident.LinkEntities.Add(new LinkEntity("incident", "systemuser", "modifiedby", "systemuserid", JoinOperator.LeftOuter));

                        queryIncident.LinkEntities[6].EntityAlias = "users";

                        queryIncident.LinkEntities[6].Columns.AddColumns(

                            "fullname",

                            "domainname",

                            "businessunitid"

                            );


I have no problem retrieving "fullname" & "domainname" value using below lines.

string entRefUsersFullName = entIncident.Contains("users.fullname") ? entIncident.GetAttributeValue<AliasedValue>("users.fullname").Value.ToString() : "";

string entRefUsersDomainName = entIncident.Contains("users.domainname") ? entIncident.GetAttributeValue<AliasedValue>("users.domainname").Value.ToString() : "";


But I'm unable to do so for "businessunitid". I'm receiving "Microsoft.Xrm.Sdk.AliasedValue" error when i run below line. Any advise?

var businessunitID = entIncident.GetAttributeValue<AliasedValue>("users.businessunitid");

var businessunitGUID = businessunitID.ToString();

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,986 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,588 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans