上两节我们创建了一个 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. 微信小程序,加载更多

    html <!-- 头部 --> <view class='tab'> <view class="tab-new {{selected_new?'active' ...

  2. StringRedisTemplate常用API

    转载自网络: //向redis里存入数据和设置缓存时间stringRedisTemplate.opsForValue().set("test", "100",6 ...

  3. Codeforces 1064 D - Labyrinth

    D - Labyrinth 对于位置(i,j), j - c = R - L = const(常数), 其中R表示往右走了几步,L表示往左走了几步 所以R越大, L就越大, R越小, L就越小, 所以 ...

  4. Angular4.0 项目报错:Unexpected value xxxComponent' declared by the module 'xxxxModule'. Please add a @Pipe...

    最近刚刚开始学习angular 4.0,在网上找了一个小项目教程学习,然而学习的过程有点艰辛,,各种报错,我明明就是按照博主的步骤老老实实走的呀!!话不多说,上bug-  .- Uncaught Er ...

  5. 7.7 GRASP原则七: 纯虚构 Pure Fabrication

    GRASP原则七: 纯虚构 Pure Fabrication  如果依据信息专家原则获得的解决方案不合适,既不想违反低耦合.高内聚,也不想违 反其他的原则, 该如何把职责分配给对象?  左右为难… ...

  6. golang并发(1)介绍

    概述 简而言之,所谓并发编程是指在一台处理器上“同时”处理多个任务. 随着硬件的发展,并发程序变得越来越重要.Web服务器会一次处理成千上万的请求.平板电脑和手机app在渲染用户画面同时还会后台执行各 ...

  7. vue中修改了数据但视图无法更新的情况

    数组数据变动:我们使用某些方法操作数组,变动数据时,有些方法无法被vue监测,有些可以 Vue包装了数个数组操作函数,使用这些方法操作的数组去,其数据变动时会被vue监测: push() pop() ...

  8. asp.net ajax控件选项卡控件的选项卡的动态显示与隐藏问题

    if (dq_gly.Yhm != "admin") { this.TabContainer1.Tabs[0].Visible = false; this.TabContainer ...

  9. 201621123075 week8-集合

    1. 本周学习总结 以你喜欢的方式(思维导图或其他)归纳总结集合相关内容. 2. 书面作业 1. ArrayList代码分析 1.1 解释ArrayList的contains源代码 indexOf中对 ...

  10. C# MVC 微信支付教程系列之公众号支付

    微信支付教程系列之公众号支付           今天,我们接着讲微信支付的系列教程,前面,我们讲了这个微信红包和扫码支付.现在,我们讲讲这个公众号支付.公众号支付的应用环境常见的用户通过公众号,然后 ...