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. CentOS磁盘用完的解决办法,以及Tomcat的server.xml里无引用,但是项目仍启动的问题

    这是我2018年的第一篇博客...人真是懒了啊...最近在写微信小程序,觉得小程序做的也... 好了不吐槽了,言归正传 前言: 由于我之前不是买了个三年的香港服务器么 , 之前广州2的服务器我就没有续 ...

  2. MyEclipse运行Java出错:could not find the main class:test.program will exit(导入项目)

    自己新建的项目运行没有任何问题.但是我导入的很早以前别人写的项目,然后run就会弹框could not find the main class:test.program will exit 请确认JA ...

  3. js 数组原型

    Array.isArray( Array.prototype ) // A. true // B. false // C. error // D. other 答案是A. 其实 Array.proto ...

  4. 腾讯云服务器突然远程连不上(包含ssh,拒绝访问)

    版权声明:本文转载自  https://blog.csdn.net/Alexwu555/article/details/78448113, 暂时这样 , 以后再来整理.不太习惯不能直接贴截图啊 配置安 ...

  5. vue-路由懒加载

    将import ... from..改为 const Foo = resolve => require(['./Foo.vue'], resolve)

  6. js 字符串跟数组的相互转化

    一:字符串转化为数组 例子: var str = "3:2;2:1"; 要变成 arr= [{ a:"3", b:"2", bol:fals ...

  7. MVC和MVVM对比

    被误解的 MVC MVC 的历史 MVC,全称是 Model View Controller,是模型 (model)-视图 (view)-控制器 (controller) 的缩写.它表示的是一种常见的 ...

  8. windows下《Go Web编程》之Go环境配置和安装

    <Go Web编程>笔者是基于unix下讲述的,作为入门练手,我选择在windows下开发,全程按照目录进行... 一.安装 windows下需要安装MinGW,通过MinGW安装gcc支 ...

  9. Saiku关于MDX过滤的使用(九)

    Saiku查询设定:Saiku查询数据时,每次都是全量查询的,我们现在需要默认展示近一周的数据. 通过编写使用MDX表达式进行过滤 通过编写MDX表达式,添加新的指标信息对一周以内的数据进行标识 (其 ...

  10. Hadoop学习笔记04_Hbase

    大数据开发的学习,组件还是很多的,都需要掌握并多加练习. 最好的参考文档当然是官方的了. 因为Hadoop生态圈组件很多,所以,在建设之初一定要检查好各版本的兼容性.避免后期麻烦. 我的练习使用Had ...