对于LookUp类型字段的取值。若当前的LookUp字段发生了变化,则在取当前的LogicName和Id是可以取到的,但是Name的值是null。可以取PostEntity的Name来解决这个问题。
建议取值时都使用PostEntity。
demo
Entity targetEntity = (Entity)plugin.Context.InputParameters["Target"];
Entity postEn = plugin.Context.PostEntityImages[entityName];
if (targetEntity.Contains("new_productpartsid"))
{
string name_target = targetEntity.GetAttributeValue<EntityReference>("new_productpartsid").Name; //name_target=null
string name_post = postEn.GetAttributeValue<EntityReference>("new_productpartsid").Name;//name_post可以取到值
}