创建一个dynamics 365 CRM online plugin (五) - Images in Plugin
Snapshots of the primary entity's attributes from database before(pre) and after (post) the core platform operation.
怎么理解这句话呢
简单的我们可以理解PreOperation与PostOperation的 entity中数据的镜像.
使用Pre-Entity镜像的一些案例:
1. 如果你需要对original data在modification之前做使用.
2. 如果你需要form的original data没有被modified修改之前做读取.
PS: local name 为field的label name/entity name. Schema name 为数据库中field的名字
这次我们将修改leader 中的filedbusiness telephone number(logical name 为telephone1)
我们将plugin中try模块里面的代码用以下代码覆盖掉
我们可以看到,我们获取了modifiedBusinessPhone 为update之后的值.
我们又使用了preImage这个value 从PreEntityImages镜像中获取original value 为originalBusinessPhone
- // Plug-in business logic goes here.
- //Pre and post entity images
- // Snapshots of the primary entity's attributes from database before (pre) and after (post) the core platfomr operation.
- // This is modified business phone number
- var modifiedBusinessPhone = entity.Attributes["telephone1"].ToString();
- // Retrieve preEntity Images
- var preImage = (Entity)context.PreEntityImages["PreImage"];
- // Normally we don't retrieve post entity images with following reason
- // 1. After the postOperation, we are on the current situation modifed data
- // 2. When retrieve the postEntityImages, due to it is not created, the entity will be null.
- // Entity postImage = (Entity)context.PostEntityImages["PostImage"];
- // Retrieve original business phone number
- var originalBusinessPhone = preImage.Attributes["telephone1"].ToString();
- // Display the information in the error log
- throw new InvalidPluginExecutionException("Phone number is changed from" + originalBusinessPhone + " to " + modifiedBusinessPhone);
我们build代码之后打开我们的plugin registration tool.
点开我们的MyCRM Assembly, 点开class PreEntityImageDemo(我创建的新的class名称).
在update我们的MyCRM assembly之后,我们点击建立新的Step
创建Step之后, 我们需要右键Step建立image
PS:因为我们不需要全局的fields都做触发,所以在register step的时候切记Filtering Attributes只勾选telephone1, 创建image镜像的时候只在Parameters中指勾选telephone1.
我们打开我们的CRM的lead
点击保存之后,可以发现我们的business Phone 有在error log中改动
创建一个dynamics 365 CRM online plugin (五) - Images in Plugin的更多相关文章
- 创建一个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 (十) - Isolation mode or trust mode
Isolation Mode 也被称作为Plugin Trust CRM里面有两种plugin trust / isolation mode 1. Full Trust 只在OP系统中可使用,没有限制 ...
- 创建一个dynamics 365 CRM online plugin (八) - 使用Shared Variables 在plugins 之前传递data
CRM 可以实现plugin之前的值传递. 我们可以使用SharedVariables 把值在plugin之间传递 实现plugins之间的传递非常简单,我们只需要用key value pair来配对 ...
- 创建一个dynamics 365 CRM online plugin (六) - Delete plugin from CRM
我们之前都学习到怎么添加,debug还有update plugin. 今天带大家过一下怎么从CRM instance当中删除plugin. 首先让我们打开Settings -> Customiz ...
- 创建一个dynamics 365 CRM online plugin (二) - fields检查
Golden Rules 1. Platform only passes Entity attributes to Plugin that has change of data. 2. If the ...
随机推荐
- No mapping found for HTTP request with URI [/crmcrmcrm/css/bootstrap.min.css] in DispatcherServlet with name 'springMvc'
先把错误贴上来 No mapping found for HTTP request with URI [/crmcrmcrm/css/sb-admin-2.css] in DispatcherServ ...
- Testner测试圈关于页面响应时间的测试行业标准
Testner测试圈针对小程序页面的响应时间标准建议如下:0-2秒 用户体验好,可以选择性改善,如首屏体验做到秒开等2-4秒 用户体验一般,有改善空间4-6秒 用户体验较差,有较大改善空间6秒以上 用 ...
- java第八周作业
分析代码: public final class LineItemKey implements Serializable { private Integer customerOrder; privat ...
- 关于Java方法重载
今天在做项目的时候发现一个问题,如果有两个方法是重载的,而且他们的参数一个是父类,一个是子类,那么调用的时候会调用哪个函数呢? 做了个测试,发现调用的是子类. 例子: public class Ani ...
- 运维shell脚本函数语法
在fun.sh 文件里,使用函数来封装脚本内容 usege() { echo "hello world" echo "脚本怎么使用函数......"}usege ...
- 更改Windows更新源(解决公司内部网络无法下载语言包或更新的问题)
打开注册表 找到HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate 将WUServer.WUStatusServe ...
- 3D数学基础(一)Unity坐标系
Unity引擎时非常成熟的,引擎内部运用了很多的数学知识,他对开发者来说是不可见的,而且他已经封装好的算法也不是很全面.此外,要是使用引擎封装好的算法也要明白其实现的原理. 写过一些代码,也参考了一些 ...
- vue 获取当前时间
timeNow () { return moment().utc().format('YYYY年MM月DD日') + ' ' + moment().utc().format('dddd')}
- Hadoop IO
检测损坏数据的常用方法是第一次进入系统时计算数据的校验和,然后和传输后新生成的校验和进行匹配.若匹配失败,则认为数据被损坏了.常用CRC-32(cyclic redundancy check,循环冗余 ...
- 从零开始写自己的PHP框架系列教程(一)[core.php]
这里我直接上代码: /** * 框架核心 */ if (version_compare(PHP_VERSION, '5.3.0','<')) { header("Content-Typ ...