创建一个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 ...
随机推荐
- 《温故而知新》JAVA基础四
类的封装 定义:将类的一些信息隐藏起来,不允许外部的程序直接的访问,而是通过该类提供的一些方法来获取 好处:只能通过特定的法方法访问数据,保护了数据, 实现封装的步骤: 修改属性的可见性:(一般类属性 ...
- 【转】 RGB各种格式
转自:https://blog.csdn.net/LG1259156776/article/details/52006457?locationNum=10&fps=1 RGB组合格式 名字 ...
- scala面试题总结
一.scala语言有什么特点?什么是函数式编程?有什么优点? 1.scala语言集成面向对象和函数式编程 2.函数式编程是一种典范,将电脑的运算视作是函数的运算. 3.与过程化编程相比,函数式编程里的 ...
- Iris 语录
Iris:hello,Loki first congratulatioins to you to upgrade to V2You really did a big progress in v0 an ...
- Django+七牛上传+查看+下载文件相关函数,新整理未完全测试
M class File(models.Model): # 文档模型 name = models.CharField(max_length=255) staff = models.ForeignKey ...
- Set集合中的treeSet问题:cannot be cast to java.lang.Comparable;
使用TreeSet保存自定义对象时, 必须让定义对象的类实现Comparable接口,并重写compareTo()方法 否则报 实体类User:cannot be cast to java.lang. ...
- 解决Android studio生成H文件时报找不到类文件错误
今天整理思路时觉得在native直接调用java的方法显示这个办法挺不错 于是就用到了生成H文件 可能我的编译环境和他们的不一样 网上的教程如下 javah -d ../jni com.jm.prom ...
- 配置react, redux, next.js环境
1. react https://reactjs.org/docs/add-react-to-a-new-app.html npm install -g create-react-app create ...
- python -- 面向对象-成员
1.成员 在类中,你能写的所有内容都是类的成员 2.变量 1.实例变量:由对象去访问的变量,一般使用是 对象 . 属性 class Person: def __in ...
- adb command not found / abd' 不是内部或外部命令,也不是可运行的程序 或批处理文件。最简易修改
此处提供最简易高效的方法 不需要添加.bash_profile 只需手动设置环境变量 1.打开环境变量设置页面:确保你ANDROID_HOME, JAVA_HOME已经设置好,我们针对abd的环境配置 ...