创建一个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 没有输入, 将会以下面截图的内容一样报错.
为了避免这个问题, 我们需要对代码做一系列的修改.


我们要在代码上面做null check

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

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


这时候可能有人会问到, last name 为什么不检测呢? lastName 是必填项, 不必在代码中再做检查.
创建一个dynamics 365 CRM online plugin (二) - fields检查的更多相关文章
- 创建一个dynamics 365 CRM online plugin (九) - Context.Depth
让我们来看看官方文档是怎么讲的 https://docs.microsoft.com/en-us/previous-versions/dynamicscrm-2016/developers-guide ...
- 创建一个dynamics 365 CRM online plugin (七) - plugin当中的Impersonation角色
我们之前创建的plugin都是使用default的 run in User's Context. 理解就是使用正在登陆的security context用户信息 那有个问题,如果当前用户的securi ...
- 创建一个dynamics 365 CRM online plugin (四) - PreValidation
开始之前,我们要确认一下 Plugin 的 pipeline. PreValidation -> PreOperation -> Server Side System Main Event ...
- 创建一个dynamics 365 CRM online plugin (三) - PostOperation
上两节我们创建了一个 PreOperation的plugin 今天我们创建一个PostOpeartion的plugin和之前的plugin连接起来 当创建contact之后,我们要添加一个task给新 ...
- 创建一个dynamics 365 CRM online plugin (一) - Hello World Plugin
源代码连接:https://github.com/TheMiao/Dynamics365CRM/blob/master/MyCRM/MyCRM/HelloWorld.cs 首先,我们需要创建一个.NE ...
- 创建一个dynamics 365 CRM online plugin (十二) - Asynchronous Plugins
这篇是plugin的终结. 通过之前的11期我们应该发现了plugin其实学习起来不难. async plugin 是把plugin的功能async run起来. e.g. 我们之前做过的preOp ...
- 创建一个dynamics 365 CRM online plugin (十) - Isolation mode or trust mode
Isolation Mode 也被称作为Plugin Trust CRM里面有两种plugin trust / isolation mode 1. Full Trust 只在OP系统中可使用,没有限制 ...
- 创建一个dynamics 365 CRM online plugin (五) - Images in Plugin
Snapshots of the primary entity's attributes from database before(pre) and after (post) the core pla ...
- 创建一个dynamics 365 CRM online plugin (八) - 使用Shared Variables 在plugins 之前传递data
CRM 可以实现plugin之前的值传递. 我们可以使用SharedVariables 把值在plugin之间传递 实现plugins之间的传递非常简单,我们只需要用key value pair来配对 ...
随机推荐
- 浅谈Overload和Override
Overload是重载的意思,Override是覆盖的意思,也就是重写. 重载Overload表示同一个类中可以有多个名称相同的方法,但这些方法的参数列表各不相同(即参数个数或类型不同). 重写Ove ...
- spring-cloud-config-server——Environment Repository(File System Backend)
参考资料: https://cloud.spring.io/spring-cloud-static/spring-cloud-config/1.4.0.RELEASE/single/spring-cl ...
- MVC _Ajax的使用【七】
一.本篇主要写的是在MVC项目中一种ajax的使用方法 1. 首先在控制器中创建两个方法,showCreate()和AddUserInfo() using System; using System. ...
- CentOS7.x系统中使用Docker时,在存储方面需要注意的问题
简述: 1.Docker 1.12.6/v17.03文档中CentOS7系统下安装时,明确说明,用于生产时,必须使用devicemapper驱动的direct-lvm模式,需要我们提前准备好块设备,以 ...
- 简单的class及运算符重载
#include <iostream> #include <vector> #include <algorithm> using namespace std; cl ...
- PHP设计模式概念
设计模式(Design Pattern)是对软件设计中普遍存在(反复出现)的各种问题,所提出的解决方案 设计模式并不直接用来完成代码的编写,而是描述在各种不同情况下,要怎么解决问题的一种方案.面向对象 ...
- 路由表flags的U值引起的能ping通网关,ping不通其它网段的案例
故障的: 正常的: 初步分析: 看路由表的flags ,之前故障时是U.现在正常的是UG查了下说明,应该是这个原因.U — 路由是活动的G — 路由指向网关
- micro-template改造
(function ($) { $.fn.razor = function (data) { var render=$(this).data('razor'); if (!render) { var ...
- 数独_erlang解题代码
前几天LP玩数独,玩到大师级各种被虐,我看了看说,分分钟帮你做出来, 结果当然没有做出来. 于是上网搜了下数独的解题代码,看了下C的代码,大多是递归之类的(如http://blog.sina.com. ...
- 2018普及组摆渡车洛谷5017(dp做法)
啦啦啦,这一篇是接上一篇的博客,上一篇是记忆化搜索,而这一篇是dp+前缀和小技巧 dp这种玄学做法我这种蒟蒻当然不是自己想出来的,参考https://blog.csdn.net/kkkksc03/ar ...