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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Syntax to retrieve single and multiple records in plugin code.

(0) ShareShare
ReportReport
Posted on by

What is the Syntax to retrieve single and multiple records in plugin code.

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Arpit Shrivastava Profile Picture
    7,518 User Group Leader on at

    Retrieve Multiple Example:

    //Create a query expression specifying the link entity alias and the columns of the link entity that you want to return
        QueryExpression qe = new QueryExpression();
        qe.EntityName = "account";
        qe.ColumnSet = new ColumnSet();
        qe.ColumnSet.Columns.Add("name");
    
        qe.LinkEntities.Add(new LinkEntity("account", "contact", "primarycontactid", "contactid", JoinOperator.Inner));
        qe.LinkEntities[0].Columns.AddColumns("firstname", "lastname");
        qe.LinkEntities[0].EntityAlias = "primarycontact";
    
        EntityCollection ec = _orgService.RetrieveMultiple(qe);

    Retrieve Example:

    // Retrieve the account and its name and ownerid attributes.

    // Create a column set to define which attributes should be retrieved.
    ColumnSet attributes = new ColumnSet(new string[] { "name", "ownerid" });

    Entity entityObj= _service.Retrieve('entityLogicalName', new Guid('f4a76638-458b-47b7-95a7-aca4dfbe624a'), attributes); Console.Write("retrieved, ");

     

    If my answer helped to resolve your issue, kindly verify it by clicking 'Yes'. It would be helpful to the other community members seeking to resolve a similar issue.

    Cheers
    Arpit
    https://arpitmscrmhunt.blogspot.in

     

  • Community Member Profile Picture
    on at

    Thanks Sir. It is really helpful.

  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at
  • Mahendar Pal Profile Picture
    45,095 on at

    In addition to that I will suggest you to download SDK if not done yet, you will get more sample code there. You can also msdn.microsoft.com/.../gg328300.aspx different query options

  • Akansha Profile Picture
    Microsoft Employee on at

    Gtrr

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
AS-17030037-0 Profile Picture

AS-17030037-0 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans