Hi,
I have one function which gets data as per module name related to contacts.
Code:
if (modulename == "lead" || modulename == "opportunity") { contactfield= "parentcontactid"; } else if (modulename == "salesorder" || modulename == "quote" || modulename == "invoice") { contactfield= = "customerid"; } else { } quotequery = new QueryExpression() { Distinct = false, EntityName = modulename, ColumnSet = new ColumnSet(true), Criteria = { Filters = { new FilterExpression { FilterOperator = LogicalOperator.And, Conditions = { new ConditionExpression("ownerid", ConditionOperator.Equal, userid), new ConditionExpression(contactfield, ConditionOperator.Equal, lstcredential.Contactid.ToString()) }, } } } }; queryentityCollection = _serviceProxy.RetrieveMultiple(quotequery).Entities;
But for all module there is different different name which is related to contact.for e.g.in lead it is parentcontactid but for invoice it is customerid.
So Is there any solution for fetch attribute name related to contact from entity name?because if else for each entity is not solution as I do in starting.
Please suggest me answer.