我正在尝试将 crm 4 插件转换为 CRM 2011。有人知道 CRM 2011 中的相应类型吗?
客户、CrmDateTime、CrmDecimal、CrmFloat、CBoolean、CrmMoney、所有者、选项列表、键、状态、UniqueIdentifier、CrmBoolean
public static object GetAttributeValue(this Entity target, string attributeLogicalName)
{
object value;
if (target.Attributes.Contains(attributeLogicalName))
{
value = target.Attributes[attributeLogicalName];
if ((value is Boolean) || (value is string))
return value;
else if (value is Customer)
return ((Customer)value).Value;
else if (value is CrmDateTime)
return ((CrmDateTime)value).UserTime;
else if (value is CrmDecimal)
return ((CrmDecimal)value).Value;
else if (value is CrmFloat)
return ((CrmFloat)value).Value;
else if (value is CrmNumber)
return ((CrmNumber)value).Value;
else if (value is CBoolean)
return ((CrmBoolean)value).Value;
else if (value is Lookup)
return ((Lookup)value).Value;
else if (value is CrmMoney)
return ((CrmMoney)value).Value;
else if (value is Owner)
return ((Owner)value).Value;
else if (value is Picklist)
return ((Picklist)value).Value;
else if (value is Key)
return ((Key)value).Value;
else if (value is Status)
return ((Status)value).Value;
else if (value is UniqueIdentifier)
return ((UniqueIdentifier)value).Value;
else if (value is CrmBoolean)
return ((CrmBoolean)value).Value;
return null;
}
else
return null;
}