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 365 | Integration, Dataverse...
Answered

unable to create linkentity query to fetch the correct value

(0) ShareShare
ReportReport
Posted on by 6

Hello All Experts,

I am trying to creating a query but there seems to be my less understanding which is causing not to get correct value.

it will be really great if some one can help me to get the correct id.

Below is my queryexpression

private Guid fetchconnectionRoleId2(Guid _connectionRoleId, Guid Record2Id, IOrganizationService organizationService)
{
Guid _connectionRoleId2 = new Guid();

QueryExpression reciprocalrolequery = new QueryExpression
{
EntityName = ConnectionRole.EntityLogicalName,
ColumnSet = new ColumnSet(true),
LinkEntities =
{
new LinkEntity
{
JoinOperator = JoinOperator.Inner,
LinkFromEntityName = ConnectionRole.EntityLogicalName,
LinkFromAttributeName = "connectionroleid",
LinkToEntityName = "connectionroleassociation",
LinkToAttributeName = "connectionroleid",
LinkCriteria = new FilterExpression
{
FilterOperator = LogicalOperator.And,
Conditions =
{
new ConditionExpression
{
AttributeName = "associatedconnectionroleid",
Operator = ConditionOperator.Equal,
Values = { _connectionRoleId}
}
}
}
}
};

EntityCollection resultstemp = organizationService.RetrieveMultiple(reciprocalrolequery);

i need to basically fetch the _connectionRoleId2  but this will be somewhere in the connectionrole entity , but i am not able to write the correct query.

I have the same question (0)
  • Verified answer
    EmployeeOcta Profile Picture
    6 on at

    I have got it;s answer.

    simply utilize ConnectionRoleAssociation entity to fetch the connectionrole2id

    var connectionRole2Id = (from associatedRole in xrm.ConnectionRoleAssociationSet

    where associatedRole .AssociatedConnectionRoleId.Equals(_connectionRoleId)

    select associatedRole.ConnectionRoleId);

  • MATTGUO Profile Picture
    22,349 Moderator on at

    Thanks for coming back and sharing the solution.

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 365 | Integration, Dataverse, and general topics

#1
Siv Sagar Profile Picture

Siv Sagar 93 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 74

#3
Martin Dráb Profile Picture

Martin Dráb 64 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans