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

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 CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans