创建一个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 ...
随机推荐
- 从实验室走向世界:HSP90抑制剂,一种新的癌症药物
热休克蛋白90(HSP90)是细胞内一种普遍存在的.十分保守的以及有高度活性的蛋白质,它在肿瘤细胞内的含量要比正常细胞多.作为一种分子伴侣,HSP90协助不同种类的癌蛋白(即HSP90的服务蛋白)进行 ...
- Git commit/pull/push的操作步骤
1.操作步骤需要严格执行如下顺序:commit->pull->push 2.commit:将代码提交到本地仓库. 3.pull:将远程仓库代码同步到本地仓库.如遇冲突,解决冲突,重复com ...
- 微信H5页面嵌入百度地图---解决手机的webKit定位,ios系统对非https网站不提供支持问题
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=yGQt ...
- 《剑指offer》总结二 之二叉树
目录 17.树的子结构(27ms,5836k) 18.二叉树的镜像(38ms) 22.从上往下打印二叉树(50ms,5832k) 24.二叉树中和为某一值的路径(26ms,5728k) 38.二叉树的 ...
- [luogu P3369]【模板】普通平衡树(Treap/SBT)
[luogu P3369][模板]普通平衡树(Treap/SBT) 题目描述 您需要写一种数据结构(可参考题目标题),来维护一些数,其中需要提供以下操作: 插入x数 删除x数(若有多个相同的数,因只删 ...
- jquery 获取表单的内容以JSON对象形式返回
添加一个serializeJson方法 <!DOCTYPE html> <html> <head> <meta charset="UTF-8&quo ...
- react+classnames
之前做项目的时候一直不知道有不知道有classnames这个东西,一直用的都是字符串拼接,感觉用的很别扭. classnames用法和angular1.x及vue差不多,所以用起来会比较顺手 1)安装 ...
- Mac上实现ProxyChains-NG终端代理
附上官方网站,可以自行查看:https://github.com/rofl0r/proxychains-ng 操作步骤如下: 1.在终端上用brew 安装ProxyChains-NG brew ins ...
- dede织梦 dede:arclist当前索引值
{dede:arclist row='10' titlelen='50' flag='c'} <li class="rank[field:global name='autoindex' ...
- OpenStack的HA方案
一.HA服务分类 HA将服务分为两类: 有状态服务:后续对服务的请求依赖之前对服务的请求,OpenStack中有状态的服务包括MySQL数据库和AMQP消息队列.对于有状态类服务的HA,如neutro ...