上两节我们创建了一个 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有些许不同.

  1. try
  2. {
  3. // Plug-in business logic goes here.
  4. Entity taskRecord = new Entity("task");
  5.  
  6. // Single line of text
  7. taskRecord.Attributes.Add("subject", "Follow up");
  8. taskRecord.Attributes.Add("description", "Please follow up with contact.");
  9.  
  10. // Date
  11. taskRecord.Attributes.Add("scheduledend", DateTime.Now.AddDays());
  12.  
  13. // Option set value as "High"
  14. taskRecord.Attributes.Add("prioritycode", new OptionSetValue());
  15.  
  16. // Parent record or Look up
  17. // You should link your assignment(Task) to the specific contact
  18. // 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.
  19. // taskRecord.Attributes.Add("regardingobjectid", new EntityReference("contact", contact.Id));
  20. taskRecord.Attributes.Add("regardingobjectid", contact.ToEntityReference());
  21. Guid taskGuid = service.Create(taskRecord);
  22. }

写好之后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. IOS 应用发布流程

    发布流程总结成三个步骤: iOS应用发布流程(一)------相关app证书的申请.下载以及安装 http://blog.csdn.net/ys371277787/article/details/50 ...

  2. leecode第二百一十五题(数组中的第K个最大元素)

    class Solution { public: int quick_sort_version(vector<int>& nums, int k,int begin,int end ...

  3. ubuntu解压命令(转)

    -c: 建立压缩档案 -x:解压-t:查看内容-r:向压缩归档文件末尾追加文件-u:更新原压缩包中的文件 这五个是独立的命令,压缩解压都要用到其中一个,可以和别的命令连用但只能用其中一个.下面的参数是 ...

  4. 20175317 《Java程序设计》第二周学习总结

    20175317 <Java程序设计>第二周学习总结 教材学习内容总结 第二周我学习了教材三四章的内容,了解了Java与C语言的相似与不同之处. 其中第二章学到了标识符与关键字.基本数据类 ...

  5. jQuery中防止表单提交两次的方法

    遇到过表单提交两次的情况,做个记录: 解决场景:首先是表单验证,其次是防止多次提交表单: jQuery中插件:validate_submitHandler_plugin,具体的可以使用关键字搜索: 使 ...

  6. 『Python CoolBook』C扩展库_其四_结构体操作与Capsule

    点击进入项目 一.Python生成C语言结构体 C语言中的结构体传给Python时会被封装为胶囊(Capsule), 我们想要一个如下结构体进行运算,则需要Python传入x.y两个浮点数, type ...

  7. ALV基础二:ALV的扩展功能

    https://www.cnblogs.com/sapSB/p/8532072.html 参考这个,做扩展,有些人喜欢用OO ALV有些喜欢用普通的CALL FUNC ALV...我只用LVC... ...

  8. Oracle 11g streams部署

    环境   源服务器 目标服务器 系统版本 CentOS Linux release 7.3.1611 (Core) CentOS Linux release 7.3.1611 (Core) 主机名 s ...

  9. python 实现树结构

    简述: 研究  MCTS 过程中, 需要用到树结构.  baidu  google 了一番, 找不到自己能满足自己的库或代码参考,只好再造个轮子出来 我造的树用来下五子棋 和 围棋用的,   有其它不 ...

  10. SVN客户端使用

    1.在SVN服务器添加新的用户,复制SVN URL(路径/目录). 2.在客户端电脑上下载安装SVN客户端,配置hosts文件中的内容和SVN服务器的hosts文件内容一致. hosts路径:C:\W ...