Dynamics CRM 2015/2016新特性之三十四:有了插件日志,调试插件so easy!

protected void ExecutePostTestOwnerIdUpdate(LocalPluginContext localContext)
{
if (localContext == null)
{
throw new ArgumentNullException("localContext");
} // TODO: Implement your custom Plug-in business logic.
localContext.TracingService.Trace("进入到PostTestOwnerIdAssign插件中的代码了!");
IPluginExecutionContext context = localContext.PluginExecutionContext;
var service = localContext.OrganizationService;
if (context.InputParameters.Contains("Target") && context.InputParameters["Target"] is Entity)
{
Entity currentEntity = context.InputParameters["Target"] as Entity;
localContext.TracingService.Trace(string.Format("新的OwnerId={0}", currentEntity.GetAttributeValue<EntityReference>("ownerid").Id));
Entity annotationEntity = new Entity("annotation");
annotationEntity["subject"] = "这是由注册在POSTOWNERIDUPDATE消息中的插件产生的!";
annotationEntity["objectid"] = new EntityReference(currentEntity.LogicalName, currentEntity.Id);
service.Create(annotationEntity);
}
}
protected void ExecutePostTestAssign(LocalPluginContext localContext)
{
if (localContext == null)
{
throw new ArgumentNullException("localContext");
} // TODO: Implement your custom Plug-in business logic.
localContext.TracingService.Trace("进入到PostTestAssign插件中的代码了!");
IPluginExecutionContext context = localContext.PluginExecutionContext;
var service = localContext.OrganizationService;
if (context.InputParameters.Contains("Target") && context.InputParameters["Target"] is EntityReference)
{ Entity annotationEntity = new Entity("annotation");
annotationEntity["subject"] = "这是由注册在POSTASSIGN消息中的插件产生的!";
annotationEntity["objectid"] = context.InputParameters["Target"];
if (context.InputParameters.Contains("Assignee") && context.InputParameters["Assignee"] is EntityReference)
{
localContext.TracingService.Trace(string.Format("新的OwnerId={0}", ((EntityReference)context.InputParameters["Assignee"]).Id));
}
service.Create(annotationEntity);
throw new InvalidPluginExecutionException("罗勇故意抛出的异常!");
}
}



throw new InvalidPluginExecutionException("罗勇故意抛出的异常!");



下面我们将系统设置中的启用插件跟踪日志的日志记录设置为 异常 ,就会只记录产生异常时候插件的日志消息。


Dynamics CRM 2015/2016新特性之三十四:有了插件日志,调试插件so easy!的更多相关文章
- Dynamics CRM 2015/2016新特性之三十二:新增乐观并发处理
关注本人微信和易信公众号: 微软动态CRM专家罗勇 ,回复215或者20160328可方便获取本文,同时可以在第一间得到我发布的最新的博文信息,follow me!我的网站是 www.luoyong. ...
- Dynamics CRM 2015/2016新特性之三十三:有了ExecuteTransactionRequest,再也不用担心部分成功部分失败了
关注本人微信和易信公众号: 微软动态CRM专家罗勇 ,回复216或者20160329可方便获取本文,同时可以在第一间得到我发布的最新的博文信息,follow me!我的网站是 www.luoyong. ...
- Dynamics CRM 2015/2016新特性之七:有了文档模板,打印分析So Easy
关注本人微信和易信公众号: 微软动态CRM专家罗勇 ,回复190或者20160216可方便获取本文,同时可以在第一时间得到我发布的最新的博文信息,follow me! 从CRM 2015 UR1开始, ...
- Dynamics CRM 2015/2016 Web API:Unbound Action 和 Bound Action
上篇文章介绍了Bound/Unbound Function.今天我们来看看Action吧.像我之前说的:Function和Action之前的差别能够简单理解为.Function不改动数据,可是Acti ...
- Dynamics CRM 2015/2016 Web API:Unbound Function 和 Bound Function
今天我们来看看Dynamics CRM Web API Function 吧, 这是一个新概念,刚接触的时候我也是比較的迷糊.这种命名确实是和之前的那套基于SOAP协议的API全然联系不上.好了,不说 ...
- Dynamics CRM 2015/2016 Web API:Unbound Custom Action 和 Bound Custom Action
今天我们再来看看Bound/Unbound Custom Action吧,什么是Custom Action?不知道的小伙伴们就out了,Dynamics CRM 2013就有了这个功能啦.和WhoAm ...
- Dynamics CRM 2015/2016 Web API:新的数据查询方式
今天我们来看看Web API的数据查询功能,尽管之前介绍CRUD的文章里面提到过怎么去Read数据,可是并没有详细的去深究那些细节,今天我们就来详细看看吧.事实上呢,Web API的数据查询接口也是基 ...
- Dynamics CRM 2015/2016 Web API:聚合查询
各位小伙伴们,今天是博主2016年发的第一篇文章.首先祝大家新年快乐.工资Double,哈哈.今天我们来看一个比較重要的Feature--使用Web API运行FetchXML查询! 对的,各位.你们 ...
- 【原创】Dynamics CRM 2015/2016,以PDF的形式打开SSRS报表。
基本步骤: 使用SSRS建立报表,以下的例子是以记录的GUID作为报表的参数 获取ReportSession 和 ControlId来调用报表 以PDF的形式预览报表 一.根据报表的名称获取报表的GU ...
随机推荐
- SSM框架整合之练习篇
SSM的练习 : 1开发环境 数据库:mysql5.5以上版本. Jdk:1.7 开发环境:Eclipse mars2 Spring:4.2.4 Mybatis:3.2.7 Tomcat:7 2数据库 ...
- BOM对象——Location
BOM对象--location <!DOCTYPE html> <html> <head> <meta charset="utf-8"&g ...
- Hack the De-ICE: S1.120 VM (Boot to Root)
下载地址: https://www.vulnhub.com/entry/de-ice-s1120,10/ 静态IP:192.168.1.120 主机扫描: ╰─ nmap -p1-65535 -sV ...
- IntelliJ IDEA 安装、配置和使用Lombok插件
Lombok 可用来帮助开发人员消除 Java 的重复代码,尤其是对于简单的 Java 对象(POJO),比如说getter/setter/toString等方法的编写.它通过注解实现这一目的.官网: ...
- Java之缓冲流(字节/字符缓冲流)
概述 缓冲流,也叫高效流,是对4个基本的 FileXxx 流的增强,所以也是4个流,按照数据类型分类: 字节缓冲流: BufferedInputStream , BufferedOutputStrea ...
- Leetcode题解 - 树、DFS部分简单题目代码+思路(700、671、653、965、547、473、46)
700. 二叉搜索树中的搜索 - 树 给定二叉搜索树(BST)的根节点和一个值. 你需要在BST中找到节点值等于给定值的节点. 返回以该节点为根的子树. 如果节点不存在,则返回 NULL. 思路: 二 ...
- 【网络安全】SSH协议科普文
写代码的木公 本文转载自:https://baijiahao.baidu.com/s?id=1612411213158569988&wfr=spider&for=pc 熟悉Linux的 ...
- winform删除dataGridView列报异常:System.IndexOutOfRangeException:“索引 7 没有值
winform界面如下: using System; using System.Collections.Generic; using System.ComponentModel; using Syst ...
- SQLserver、MySQL、ORCAL查询数据库、表、表中字段以及字段类型
一.SQLServer命令 1.查询SQLServer中的每个数据库 SELECT * from sysdatabases 2.查询SQLServer中指定数据库的所有表名 select name f ...
- [Go]TCP服务中增加消息队列与工作池
之前的处理中每一个连接都会创建一个主groutine , 每个连接中的主groutine中创建出读groutine 和写groutine 每个连接处理业务再单独开出一个groutine ,这样如果有1 ...