-1
我有一個函數可以根據模塊名稱相關聯繫獲取數據。獲取與來自每個實體在動態crm中使用c的聯繫相關的字段名稱#
代碼:
if (modulename == "lead" || modulename == "opportunity")
{
contactfield= "parentcontactid";
}
else if (modulename == "salesorder" || modulename == "quote" || modulename == "incident" || 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;
但對於所有模塊存在被以contact.for e.g.in導致它parentcontactid但發票是客戶ID相關的不同的不同的名稱。
那麼是否有任何解決方案從實體名稱獲取與聯繫人相關的屬性名稱?因爲如果每個實體的其他部分都不像我在開始時那樣解決。
請給我回答。
不幸的是,不,因爲主要聯繫人屬性在不同的實體之間可能不同。您將不得不切換實體名稱並派生您正在查找的屬性。 – dynamicallyCRM