Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Syntax to retrieve single and multiple records in plugin code.

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

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

*This post is locked for comments

  • Akansha Profile Picture
    Akansha on at
    RE: Syntax to retrieve single and multiple records in plugin code.

    Gtrr

  • Mahendar Pal Profile Picture
    Mahendar Pal 45,095 on at
    RE: Syntax to retrieve single and multiple records in plugin code.

    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

  • Suggested answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: Syntax to retrieve single and multiple records in plugin code.

    Hi ,

    Please follow below msdn reference -

    msdn.microsoft.com/.../microsoft.xrm.sdk.iorganizationservice.retrieve.aspx

    msdn.microsoft.com/.../microsoft.xrm.sdk.iorganizationservice.retrievemultiple.aspx

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Syntax to retrieve single and multiple records in plugin code.

    Thanks Sir. It is really helpful.

  • Verified answer
    Arpit Shrivastava Profile Picture
    Arpit Shrivastava 7,518 User Group Leader on at
    RE: Syntax to retrieve single and multiple records in plugin code.

    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

     

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,711 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,458 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans