Dynamics CRM 2015/2016 Web API:Unbound Custom Action 和 Bound Custom Action
来源:互联网 发布:网络正常魔域连接错误 编辑:程序博客网 时间:2024/06/05 03:45
今天我们再来看看Bound/Unbound Custom Action吧,什么是Custom Action?不知道的小伙伴们就out了,Dynamics CRM 2013就有了这个功能啦。和WhoAmI这类消息一样,我们都可以通过代码去调用它们,只不过呢,今天我要给大家讲讲怎么用Web API的方式去调用它们。
Custom Action也被划分为Bound和Unbound两种类型了,它们的具体含义和之前讲的Function和Action没有区别,唯一的区别就是,这里的Custom Action是我们自己配置的,这里科普下,我们可以在Setting-》Process里面创建Action,它的创建界面如下:
Bound Custom Action
Unbound Custom Action
他们的调用方式和OOB Action是一样的,没有区别,具体可以参考下面的代码片段:
Bound Custom Action
HttpRequestMessage custBoundActionReq = new HttpRequestMessage(HttpMethod.Post, webApiUrl + "/accounts(723ef58a-75bb-e511-80d9-c4346bc43f3c)/Microsoft.Dynamics.CRM.new_CreatePrimaryContactForAccount"); custBoundActionReq.Headers.Authorization = new AuthenticationHeaderValue("Bearer", auth.AcquireToken().AccessToken); JObject custBoundActionContent = new JObject(); custBoundActionContent.Add("FirstName", "Jeff"); custBoundActionContent.Add("LastName", "Xiong"); //custBoundActionContent.Add("Telephone", "15000303158"); //custBoundActionContent.Add("Email", "jeff.xiong@ghostbear.com"); custBoundActionReq.Content = new StringContent(JsonConvert.SerializeObject(custBoundActionContent), Encoding.UTF8, "application/json"); HttpResponseMessage custBoundActionResp = await client.SendAsync(custBoundActionReq); if (custBoundActionResp.IsSuccessStatusCode) { JObject result = JsonConvert.DeserializeObject<JObject>(await custBoundActionResp.Content.ReadAsStringAsync()); Console.WriteLine(result); }
Unbound Custom Action
HttpRequestMessage custActionReq = new HttpRequestMessage(HttpMethod.Post, webApiUrl + "/new_CreateDemoAccount_UA");///"accounts(723ef58a-75bb-e511-80d9-c4346bc43f3c)/Microsoft.Dynamics.CRM.new_CreateDemoAccount" custActionReq.Headers.Authorization = new AuthenticationHeaderValue("Bearer", auth.AcquireToken().AccessToken); JObject custActionContent = new JObject(); custActionContent.Add("AccountName", "Jeff's Demo Account"); custActionReq.Content = new StringContent(JsonConvert.SerializeObject(custActionContent), Encoding.UTF8, "application/json"); HttpResponseMessage custActionResp = await client.SendAsync(custActionReq); if (custActionResp.IsSuccessStatusCode) { JObject result = JsonConvert.DeserializeObject<JObject>(await custActionResp.Content.ReadAsStringAsync()); Console.WriteLine(result); }
是不是很轻松呢?小伙伴们要知道,在之前,我们定义这样的Custom Action得花九牛二虎之力去呀,倒腾 web service什么的。现在我们只需要通过UI界面就可以轻松的配置一个不错的Action,是不是很幸福呢!
0 0
- Dynamics CRM 2015/2016 Web API:Unbound Custom Action 和 Bound Custom Action
- Dynamics CRM 2015/2016 Web API:Unbound Action 和 Bound Action
- Dynamics CRM 2015/2016 Web API:Unbound Function 和 Bound Function
- Dynamics CRM 2013 初体验(9):Custom Action
- Dynamics CRM 利用Profiler来调试custom action
- Dynamics CRM 2015/2016 Web API:验证和授权
- Dynamics CRM 2015/2016 Web API:简介
- Custom Drillthrough Action
- InstallShield的Custom Action
- wix custom action
- Dynamics CRM2016 Web API之Use custom FetchXML
- WiX Custom Action 的deferred !
- Dynamics CRM 2015/2016 Web API:聚合查询
- Dynamics CRM 2015/2016/365 Web API:用户模拟
- Dynamics CRM 2016 Web API 消息列表
- Dynamics CRM 2015/2016 Web API:注册 APP(调用CRM Online Web API)
- Dynamics CRM2016 通过web api来调用自定义action
- 我的图片AI中 Custom Action
- 推荐一本ArmLinux系统底层的书
- 绝对路径和相对路径
- java自动装箱拆箱
- 博客第一篇,立贴为证!
- cocoa获取管理员权限
- Dynamics CRM 2015/2016 Web API:Unbound Custom Action 和 Bound Custom Action
- Spring使用JdbcTemplate实现对数据库操作
- Scala学习1之用sbt和脚本一步编译打包运行scala程序
- iOS判断设备
- 【CSS】初识选择器(1)
- 数据结构基础
- [leetcode]Valid Parentheses
- 【开源中国Android客户端】源码分析(二)网络数据传输接口
- 数据结构基础