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,
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,
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/
Hope this helps.
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
If these entities have a relationship, you can use a quick view form without writing any code technet.microsoft.com/.../dn531145.aspx
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.
Mohamed Amine Mahmoudi
83
Super User 2025 Season 1
Community Member
54
dkrishna
6