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 :
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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
11manish Profile Picture

11manish 52

#2
Manoj - ManoVerse Profile Picture

Manoj - ManoVerse 43 Super User 2026 Season 1

#3
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 14 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans