上两节我们创建了一个 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的更多相关文章

  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 (一) - Hello World Plugin

    源代码连接:https://github.com/TheMiao/Dynamics365CRM/blob/master/MyCRM/MyCRM/HelloWorld.cs 首先,我们需要创建一个.NE ...

  5. 创建一个dynamics 365 CRM online plugin (十) - Isolation mode or trust mode

    Isolation Mode 也被称作为Plugin Trust CRM里面有两种plugin trust / isolation mode 1. Full Trust 只在OP系统中可使用,没有限制 ...

  6. 创建一个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 ...

  7. 创建一个dynamics 365 CRM online plugin (二) - fields检查

    Golden Rules 1. Platform only passes Entity attributes to Plugin that has change of data. 2. If the ...

  8. 创建一个dynamics 365 CRM online plugin (八) - 使用Shared Variables 在plugins 之前传递data

    CRM 可以实现plugin之前的值传递. 我们可以使用SharedVariables 把值在plugin之间传递 实现plugins之间的传递非常简单,我们只需要用key value pair来配对 ...

  9. 创建一个dynamics 365 CRM online plugin (六) - Delete plugin from CRM

    我们之前都学习到怎么添加,debug还有update plugin. 今天带大家过一下怎么从CRM instance当中删除plugin. 首先让我们打开Settings -> Customiz ...

随机推荐

  1. MVC校验方式【六】

    一.以往的校验都是自己写正则表达式校验,本篇讲的是通过MVC自带的jquery文件进行校验 实现步骤:1. 在webform页面中引入两个jquery文件,10,11行的代码. <%@ Page ...

  2. openssl 交叉编译

    建立build文件夹 mkdir build 在build文件夹中建立run.sh文件 cd build touch run.sh chmod 755 run.sh run.sh文件内容如下: #!/ ...

  3. datatables弹窗报错信息屏蔽方法

    在使用datatables的时候,总是会弹出这样的warning: Error: DataTables warning: table id=data_table- Requested unknown ...

  4. vuejs点滴

    博客0.没事的时候可以看的一些博客:https://segmentfault.com/a/1190000005832164 http://www.tuicool.com/articles/vQBbii ...

  5. python学习(五)

  6. 1. Two Sum&&15. 3Sum&&18. 4Sum

    题目: 1. Two Sum Given an array of integers, return indices of the two numbers such that they add up t ...

  7. 搭建openstf平台的那些事

    最近老板建议秀下肌肉,搭建一个STF android 真机测试平台,记录一下坑. 1. stf 是node开发的,通过npm即可安静,依赖的数据库是rethinkdb, 如果搭配appium效果更佳, ...

  8. CloudStack学习-1

    环境准备 实验使用的虚拟机配置 Vmware Workstation 虚拟机系统2个 系统版本:centos6.6 x86_64 内存:4GB 网络:两台机器都是nat 磁盘:装完系统后额外添加个50 ...

  9. 使用matlab生成用于ROM初始化的coe文件(转)

    reference:https://www.cnblogs.com/chensimin1990/p/9759368.html t=0:2*pi/2^12:2*pi; y=0.5*sin(t)+0.5; ...

  10. vue bus的使用

    vue中的bus事件,一般作为中央事件总线来使用 简单例子:比如在A,B组件为兄弟组件,现在A要调用B的中C事件 1.创建一个bus.js 内容: import Vue from 'vue' cons ...