What is the Syntax to retrieve single and multiple records in plugin code.
*This post is locked for comments
What is the Syntax to retrieve single and multiple records in plugin code.
*This post is locked for comments
Gtrr
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
Hi ,
Please follow below msdn reference -
msdn.microsoft.com/.../microsoft.xrm.sdk.iorganizationservice.retrieve.aspx
msdn.microsoft.com/.../microsoft.xrm.sdk.iorganizationservice.retrievemultiple.aspx
Thanks Sir. It is really helpful.
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
André Arnaud de Cal... 291,711 Super User 2024 Season 2
Martin Dráb 230,458 Most Valuable Professional
nmaenpaa 101,156