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 ...
随机推荐
- 在Chrome 中使用Vimium
原文连接:https://blog.csdn.net/wuxianjiezh/article/details/91848604 Vimium:像在 Vim 中一样使用 Chrome 安装 使用方法 在 ...
- 百度大脑UNIT3.0详解之嵌入式对话理解技术
相信很多人都体验过手机没有网时的焦虑,没有网什么也做不了.而机器人也会遇到这样的时刻,没有网或者网络环境不好的情况下,无法识别用户在说什么,也无法回复用户.在AIoT(AI+物联网)飞速普及的现在,智 ...
- .NET Core 3.0 Preview 6中对ASP.NET Core和Blazor的更新
我们都知道在6月12日的时候微软发布了.NET Core 3.0的第6个预览版.针对.NET Core 3.0的发布我们国内的微软MVP-汪宇杰还发布的官翻版的博文进行了详细的介绍.具体的可以关注&q ...
- 理解MVVM在react、vue中的使用
理解MVVM在react.vue中的使用 一:什么是MVC.为什么不用MVC 1:MVC的含义: M(modal):是应用程序中处理数据逻辑的部分. V (view) :是应用程序中数据显示的部分. ...
- U8隐藏的配置项
数据表:accinformation 我使用了一个是否自动审核库存生成的单据,看看是否能解决调拨单自动生成的其他出入库单自动审核的功能.
- oracle 查询两个字段值相同的记录
select A.* from tb_mend_enrol A, (select A.Typeid, A.address from tb_mend_enrol A group by A.Typeid, ...
- Oracle通过SQL语句查看table所引用的对象(View/Function/Procedure/Trigger)
通过使用user_dependencies进行查看,如下: SELECT * FROM user_dependencies WHERE referenced_name='SFCUSN' --Table ...
- Python的filter方法实现筛选功能
filter方法可以实现筛选,第一个参数是一个函数,返回值是True或者False,第二个参数可以是str.tuple.list,将后面的参数依次传递给函数,依次判断结果,留下结果为 True的.比如 ...
- [阅读笔记]EfficientDet
EfficientDet 文章阅读 Google的网络结构不错,总是会考虑计算性能的问题,从mobilenet v1到mobile net v2.这篇文章主要对近来的FPN结构进行了改进,实现了一种效 ...
- (day69)axios、配置ElementUI、配置jQuery和Bootstrap、Django中的CORS问题
目录 一.Vue的ajax插件:axios 二.Django中的CORS跨域问题 (一)同源策略 (二)解决方式(cors模块) 三.Vue配置ElementUI 四.Vue配置jQuery和Boot ...