将值插入crm动态

时间:2017-05-03 15:36:16

标签: c# asp.net asp.net-mvc sitecore

如何将Sitecore WFFM表单查找字段中的值插入CRM Dynamics中的查找字段?我能够从WFFM获得Guid表单中的值,但它没有插入到CRM动态中。为什么?

public void Execute(ID formid, AdaptedResultList fields, params object[] data)
{
string email = fields.GetValueByFieldID(Email); //this works and insert into CRM
string CountryName = fields.GetValueByFieldID(Country); // this does not work and value is not inserted into the CRM. This one is picking up value in GUID form.
}

1 个答案:

答案 0 :(得分:0)

对于Dynamics CRM: Lookupfields是EntityReferences。 因此,您必须使用实体的LogicalName和Id(Guid)设置EntityReference。

示例:

Entity entity = new Entity("country");
entity["lookupFieldAttributeName"] = new EntityReference("[PointingToEntityLogicalName]",[PointingToEntity_EntityId(GUID)]);

此外,SO上还有很多帖子。

的示例: