Dynamice CRM 365 的Plugin容易忽略的知识点,额外容易出错

Dynamice CRM 365 的Plugin容易忽略的知识点,额外容易报错。这里整理了2点:

Entity targetEntity = (Entity)Context.InputParameters["Target"];  //取到传入的实体

1.针对lookup类型,在targetEntity中只能拿到id,拿不到Name

2.针对OptionSetValue类型,想去下拉的描述,必须重新查询,不能直接targetEntity.FormattedValues["new_formstatus"];否则报错:System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.

 

原文地址:https://www.cnblogs.com/parkerchen/p/13278372.html