Announcements
hi,
i have a requirement.I have 2 entities A and B.When i am working on B entity i want to retrieve the records from A entity.How can i retrieve using C#?
*This post is locked for comments
Hi Teja,
Check this,
congruentdynamics.blogspot.in/.../retrieve-linked-entity-data-using-query.html
If there is a relationship between Entity A and Entity B, such that there is a lookup for example in Entity B that has the value of a record in Entity A, you can do a simple QueryByAttribute or QueryExpression.
QueryByAttribute query = new QueryByAttribute();
query.ColumnSet = new ColumnSet(true);
query.EntityName = "new_entityb";
query.AddAttributeValue("new_entityaid", entityAId); // This is a Guid
RetrieveMultipleRequest request = new RetrieveMultipleRequest();
request.Query = query;
RetrieveMultipleResponse response = (RetrieveMultipleResponse)service.Execute(request);
Entity results = (Entity)response.EntityCollection.Entities[0];
try
{
Guid lookupId = new Guid();
lookupId = results.Id;
return lookupId;
}
catch (FaultException<OrganizationServiceFault> ex)
throw ex;
Hope this helps.
If these entities have a relationship, you can use a quick view form without writing any code technet.microsoft.com/.../dn531145.aspx
If you have relationship between these entities, you can use retrieve (as you will have lookup) otherwise you can use retrieve multiple to get record.
You can refer SDK : msdn.microsoft.com/.../gg328198.aspx
Thanks
Hi,
You could use QueryExpression in C# to retrieve the records of an entity in Dynamics CRM.
See: arunpotti.wordpress.com/.../retrieve-records-using-query-expression-c-sdk-in-crm/
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.
Congratulations to our community stars!
Expanding mentorship, skilling, and AI innovation
These are the community rock stars!
Stay up to date on forum activity by subscribing.