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 :
Customer experience | Sales, Customer Insights,...
Suggested Answer

How to get subgrid records of the record present in lookup field using plugin

(0) ShareShare
ReportReport
Posted on by 255

Hi All,

I am very new to to writing plugin codes . i nees to some help regarding accessing subgrid record.

following is the scenario.

Entity A: having lookp of Entity B as "Current Status"

Entity B: have subgrid of mails

i need to write plugin on create of entity A to extract the related records of "mails" of the record present in lookup(Current status) on Entity A

can anybody help

I have the same question (0)
  • Suggested answer
    T.I.A Profile Picture
    1,760 on at

    !. Get the ID of the lookup on Entity A. You can do this using the post image or query it.

    2. FetchExpression or QueryExpression (depending on the coding standard you're using on your project) to retrieve all mails where the lookup on those records in the ID of the lookup you retrieved from Entity A

  • T.I.A Profile Picture
    1,760 on at

    Here's are articles on images and queries

    Images:

    crmchap.co.uk/.../

    Querying:

    docs.microsoft.com/.../use-querybyattribute-class

    docs.microsoft.com/.../use-fetchxml-construct-query

  • Suggested answer
    Pawar Pravin  Profile Picture
    5,237 on at

    First of all try to get GUID of lookup record in ms crm plugin using below syntax:

    Guid EntityBId = EntityB.Attributes.Contains("lookuplogicalname") && EntityB.Attributes["lookuplogicalname"] != null ? EntityB.GetAttributeValue<EntityReference>("lookuplogicalname").Id : Guid.Empty;

    Then pass this GUID to either LINQ, fetchexpression or query expression to retrieve all related email's with entity B.

    Please refer below url for reference:

    csharp.hotexamples.com/.../php-fetchexpression-class-examples.html

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 > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 108 Super User 2025 Season 2

#2
Jimmy Passeti Profile Picture

Jimmy Passeti 50 Most Valuable Professional

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 49 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans