创建一个dynamics 365 CRM online plugin (二) - fields检查

Golden Rules

1. Platform only passes Entity attributes to Plugin that has change of data.

2. If the user does not enter any value into attribute, the attribute is not avaible in AttributeCollection of Entity.

3. Always check if attribute is present in the collection before you use it.

 

 介于上面三条rules, 我们来改动一下上篇博客中的问题.

如果用户firstName 没有输入, 将会以下面截图的内容一样报错. 

为了避免这个问题, 我们需要对代码做一系列的修改.

创建dynamics CRM plugin

 

 

创建dynamics CRM plugin

我们要在代码上面做null check

 

 创建dynamics CRM plugin

 

在register tool 上选中之前创建的assembly, 并且勾选update,做更新.

 

创建dynamics CRM plugin

 

我们这次再测试一下创建新的contact. 

 

 

创建dynamics CRM plugin

 

创建dynamics CRM plugin

 

 

这时候可能有人会问到, last name 为什么不检测呢? lastName 是必填项, 不必在代码中再做检查.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值