上两节我们创建了一个 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. ubuntu18.04中python虚拟环境的安装

    一:下载虚拟环境安装包 sudo apt install virtualenv sudo apt install virtualenvwrapper pwd  查看当前目录 ls -all 查看是否有 ...

  2. CentOS7.4安装和配置zabbix4.0

    一.安装zabbix前,需要搭建好LAMP环境 二.下载zabbix 进入官网:https://www.zabbix.com/ 更多详细内容请参考官方说明文档,详细的安装要求不贴出来了. https: ...

  3. Redis学习--Redis数据类型

    Redis的5种基本类型 1.String 2.Hash 3.List 4.Set 5.Sorted Set String常见用法 1.get key 返回value 2.set key value ...

  4. [C#]统计文本文件txt中的行数(快速读取)

    快速统计文本文件中的行数( StreamReader.ReadLine() ): 测试代码如下: //读取txt文件中总行数的方法 public static int requestMethod(St ...

  5. oracle数据库 concat 与 ||

    1.简述: 通过几条sql语句来引入此问题 先新建一张表,插入几条数据,如下: CREATE TABLE tab1 (col1 VARCHAR2(6), col2 CHAR(6), col3 VARC ...

  6. CentOS7.5安装Python3.7报错:configure: error: no acceptable C compiler found in $PATH --Python3

    1.问题解析 报错信息中有这样一条:configure: error: no acceptable C compiler found in $PATH即:配置错误,在$path中找不到可接受的C编译器 ...

  7. National Property CodeForces - 875C (拓扑排序)

    大意: n个字符串, 每次操作选出一种字符全修改为大写, 求判断能否使n个字符串字典序非降. 建源点s, 汇点t, s与所有必须转大写的连边, 必须不转大写的与t连边. #include <io ...

  8. SAP跳过权限检查/前提是有debug权限

    SE37,AUTH_CHECK_TCODE加断点: 执行事务代码,进入断点,修改sy-subrc = 0,执行,就可以跳过权限检查. 只给了事务代码权限,没有操作权限: CL_SUID_TOOLS== ...

  9. node 安装 vue-cli 创建vue项目

    $ npm install -g vue-cli $ vue init webpack-simple my-project $ cd my-project $ npm install $ npm ru ...

  10. Android 音视频深入 十四 FFmpeg与OpenSL ES 播放mp3音乐,能暂停(附源码下载)

    项目地址https://github.com/979451341/FFmpegOpenslES 这次说的是FFmpeg解码mp3,数据给OpenSL ES播放,并且能够暂停. 1.创建引擎 slCre ...