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检查的更多相关文章

  1. 创建一个dynamics 365 CRM online plugin (九) - Context.Depth

    让我们来看看官方文档是怎么讲的 https://docs.microsoft.com/en-us/previous-versions/dynamicscrm-2016/developers-guide ...

  2. 创建一个dynamics 365 CRM online plugin (七) - plugin当中的Impersonation角色

    我们之前创建的plugin都是使用default的 run in User's Context. 理解就是使用正在登陆的security context用户信息 那有个问题,如果当前用户的securi ...

  3. 创建一个dynamics 365 CRM online plugin (四) - PreValidation

    开始之前,我们要确认一下 Plugin 的 pipeline. PreValidation -> PreOperation -> Server Side System Main Event ...

  4. 创建一个dynamics 365 CRM online plugin (三) - PostOperation

    上两节我们创建了一个 PreOperation的plugin 今天我们创建一个PostOpeartion的plugin和之前的plugin连接起来 当创建contact之后,我们要添加一个task给新 ...

  5. 创建一个dynamics 365 CRM online plugin (一) - Hello World Plugin

    源代码连接:https://github.com/TheMiao/Dynamics365CRM/blob/master/MyCRM/MyCRM/HelloWorld.cs 首先,我们需要创建一个.NE ...

  6. 创建一个dynamics 365 CRM online plugin (十二) - Asynchronous Plugins

    这篇是plugin的终结. 通过之前的11期我们应该发现了plugin其实学习起来不难. async plugin 是把plugin的功能async run起来. e.g.  我们之前做过的preOp ...

  7. 创建一个dynamics 365 CRM online plugin (十) - Isolation mode or trust mode

    Isolation Mode 也被称作为Plugin Trust CRM里面有两种plugin trust / isolation mode 1. Full Trust 只在OP系统中可使用,没有限制 ...

  8. 创建一个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 ...

  9. 创建一个dynamics 365 CRM online plugin (八) - 使用Shared Variables 在plugins 之前传递data

    CRM 可以实现plugin之前的值传递. 我们可以使用SharedVariables 把值在plugin之间传递 实现plugins之间的传递非常简单,我们只需要用key value pair来配对 ...

随机推荐

  1. (免费电影)苹果手机合并.ts视频

    代码教程:https://mp.weixin.qq.com/s/6Oo8TOruePUxotC11zp0ag

  2. Strut2页面传参跳转 --Struts2

    1.本案例借助struts2框架,完成页面传参.跳转功能 2.代码实现 index.jsp: <form action="helloStruts2.action" metho ...

  3. Kali linux 2016.2(Rolling)里安装OpenVAS

    不多说,直接上干货! 本博文,是在Kali 2.0 linux里,安装OpenVAS. 前言 OpenVAS是一款开放式的漏洞评估工具,主要用来检测目标网络或主机的安全性.与安全焦点的X-Scan工具 ...

  4. grpc(三)之grpc客户端使用连接池

    本文使用commons-pool2来实现连接池应用 1.定义一个产生连接池的工厂,需要继承BasePooledObjectFactory,其用处是生产和销毁连接池中保存的对象.根据需求,现在池子里保存 ...

  5. linux中pam模块

    https://www.cnblogs.com/ilinuxer/p/5087447.html linux中pam模块 一.pam简介 Linux-PAM(linux可插入认证模块)是一套共享库,使本 ...

  6. Matlab:非线性高阶常微分方程的几种解法

    一.隐式Euler: 函数文件1: function b=F(t,x0,u,h) b(,)=x0()-h*x0()-u(); b(,)=x0()+*h*x0()/t+*h*(*exp(x0())+ex ...

  7. python的类和对象——类的静态字段番外篇

    什么是静态字段 在开始之前,先上图,解释一下什么是类的静态字段(我有的时候会叫它类的静态变量,总之说的都是它.后面大多数情况可能会简称为类变量.): 我们看上面的例子,这里的money就是静态字段,首 ...

  8. tcp滑动窗口详解(2)

    http://blog.csdn.net/yujun00/article/details/636495 ARQ与滑动窗口概念  滑动窗口协议,是TCP使用的一种流量控制方法.该协议允许发送方在停止并等 ...

  9. 项目开发中关于jquery中出现问题小结(textarea,disabled,关键字等)

    1.textarea: 使用 定义了一个textarea,在使用jquery的方法获取文本内容的时候总是为空. var content = $(“#content”).val();  后来测试发现,i ...

  10. Python—装饰器详解

    装饰器:(语法糖) 本质是函数,它是赋予函数新功能,但是不改变函数的源代码及调用方式   原则: 1.不能修改被装饰函数的源代码 2.不能修改被装饰函数的调用方式 3.函数的返回值也不变 这两点简而言 ...