创建一个dynamics 365 CRM online plugin (三) - PostOperation
上两节我们创建了一个 PreOperation的plugin
今天我们创建一个PostOpeartion的plugin和之前的plugin连接起来
当创建contact之后,我们要添加一个task给新创建的contact

首先,我们创建新的class, 并且取名TaskCreate.cs
其次,我们把代码Execute代码复制到TaskCreate.cs中
然后我们可以从Settings -> Customization -> Customize the System 中查看Task的Form.

本次我们取subject, description, Priority 还有 Duration
因为due date为时间, priority为option, 所以在代码上和string有些许不同.
try
{
// Plug-in business logic goes here.
Entity taskRecord = new Entity("task"); // Single line of text
taskRecord.Attributes.Add("subject", "Follow up");
taskRecord.Attributes.Add("description", "Please follow up with contact."); // Date
taskRecord.Attributes.Add("scheduledend", DateTime.Now.AddDays()); // Option set value as "High"
taskRecord.Attributes.Add("prioritycode", new OptionSetValue()); // Parent record or Look up
// You should link your assignment(Task) to the specific contact
// contact.Id can ONLY be used in the Post-validation Operation due to pre-validation will not have the ID yet and it will cost the error.
// taskRecord.Attributes.Add("regardingobjectid", new EntityReference("contact", contact.Id));
taskRecord.Attributes.Add("regardingobjectid", contact.ToEntityReference());
Guid taskGuid = service.Create(taskRecord);
}
写好之后rebuild, 并且打开Register tool. 双击我们register的assembly.
load刚才build之后生成的dll, 并且点击确定.



我们重新创建一个contact, 这次就会发现我们的activities中有一个task


创建一个dynamics 365 CRM online plugin (三) - PostOperation的更多相关文章
- 创建一个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 (一) - 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 (五) - 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 (二) - fields检查
Golden Rules 1. Platform only passes Entity attributes to Plugin that has change of data. 2. If the ...
- 创建一个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 ...
随机推荐
- LRU的实现
https://blog.csdn.net/elricboa/article/details/78847305 未看懂https://zhuanlan.zhihu.com/p/34133067
- EF Core
一个事务中 先在数据库查出一条数据进行修改 然后在进行查询 他会直接在内存中找到这条数据 不会再数据库查询了 EF Core的 linq语句中可以使用C#方法或函数 在EF6或 ...
- JS 单线程
js单线程阻塞实例setTimeout(function () { while (true) { } }, 1000);setTimeout(function () { alert('end 2'); ...
- 字符串转换整数 (atoi)
题目: 请你来实现一个 atoi 函数,使其能将字符串转换成整数. 首先,该函数会根据需要丢弃无用的开头空格字符,直到寻找到第一个非空格的字符为止. 当我们寻找到的第一个非空字符为正或者负号时,则将该 ...
- for each...in
for each...in 使用一个变量迭代一个对象的所有属性值,对于每一个属性值,有一个指定的语句块被执行. for each...in 是 ECMA-357 (E4X) 标准的一部分, 大部分非M ...
- Yii框架实现restful 接口调用,增删改查
创建模块modules; 在main.php中配置文件:(1) (2)控制器层: namespace frontend\modules\v1\controllers;use frontend\modu ...
- SQL列转行用逗号隔开
declare @result varchar(255) set @result = ” select @result = @result + cast(F_IT_FWID as varchar( ...
- java常见3种文件上传速度对比和文件上传方法详细代码
在java里面文件上传的方式很多,最简单的依然是FileInputStream.FileOutputStream了,在这里我列举3种常见的文件上传方法代码,并比较他们的上传速度(由于代码是在本地测试, ...
- python -- 内置模块02
1.os 所有和操作系统相关的内容都在os模块,一般用来操作文件系统 import os os.makedirs('dirname1/dirname2') # 可生成多层递归目录 os.removed ...
- C++开发者都应该使用的10个C++11特性 转
http://blog.jobbole.com/44015/// | 分类: C/C++, 开发 | 条评论 | 标签: C++, C语言 分享到: 本文由 伯乐在线 - 治不好你我就不是兽医 翻译自 ...