创建一个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 ...
随机推荐
- 【八】jqeury之click事件[添加及删除数据]
要求:1.添加数据显示在下方列表.2.添加的数据可动态删除. 界面显示: 代码: <!DOCTYPE html> <html> <head> <script ...
- 《深入理解Nginx:模块开发与架构解析》读书笔记
1.nginx的特点:快.扩展性强.可靠性强.内存低消耗.支持高并发.热部署.开源免费 2.nginx由master进程来管理多个(CPU数)worker进程 3.配置按功能分,有4类: 1)用于调试 ...
- (18)ProcessPoolExecutor进程池
# 新版本的进程池 ProcessPoolExecutor # 实例化进程池 ProcessPoolExcutor(cpu_count) # 异步提交任务 submit / map # 阻塞直到任务完 ...
- 20190316xlVba_设置行高的改进方案
Public Sub AutoSetRowHeight(ByVal sht As Worksheet, Optional RowsInOnePage As Long) Dim BreakRow As ...
- js 把一个对象赋值给另一个对象会指向同一个内存地址
先看一段代码: var arr1 = [1,2,3]; var arr2 = arr1; arr2.push(4); console.log(arr1)//[1,2,3,4] 为什么会输出 的是[1, ...
- JQuery的常用选择器
刚开始学JQuery写的如有错误欢迎批评指正 JQuery拥有的选择器可以让我们更快更方便找到想要的元素,然后对相应的元素进行操作 简单介绍一下一些常用的选择器: 1.基本选择器: 标签名选择器: $ ...
- STATA一小步 我的一大步
第一次用STATA,以前一直搞SPSS,简直是生产力革命啊. 记下写的第一个命令 也是实现了一个probit回归 clear cd C:\Users\Qian\Desktop\1 insheet us ...
- PI上导入RFC
ERP中创建函数:ZERP_GETSPAREPART 传入参数:SOLD_TO_ID SHIP_TO_ID 表:INTABLE OUTABLE 登陆PI, 后面正常做data type DT_PART ...
- 笨办法29IF语句
people = 20 cats = 30 dogs = 15 if people < cats: print "Too many cats! The world is doomed! ...
- mysql在查询中常见问题汇总
1.从主从表中查询外键内容(常见问题) 从主从表中查询对应的外键,需要指定外键的表,即sno=> student.sno或者score.sno 错误:select sno,sname,degre ...