Dynamics CRM2016 Web API之Use custom FetchXML
2016-04-01 14:18
459 查看
CRM2016中新增的web api支持fetch xml了,之前使用FetchXML的场景是在后天代码中通过组织服务的retrieve multiple方法,但实际的应用效果有多大,还需要在实际的项目中去体会了。
上代码,注意要对fetch xml进行编码
下图是查询出的结果
上代码,注意要对fetch xml进行编码
var fetch="<fetch mapping='logical'>" +"<entity name='account'>" +"<attribute name='accountid'/> " + "<attribute name='name'/> " + "<attribute name='primarycontactid'/> " +"</entity>" + "</fetch>" var req = new XMLHttpRequest() req.open("get", Xrm.Page.context.getClientUrl() + "/api/data/v8.0/accounts?fetchXml="+ encodeURI(fetch), false); req.setRequestHeader("Accept", "application/json"); req.setRequestHeader("Content-Type", "application/json; charset=utf-8"); req.setRequestHeader("OData-MaxVersion", "4.0"); req.setRequestHeader("OData-Version", "4.0"); req.onreadystatechange = function () { if (this.readyState == 4) { if (this.status == 200) { var data = JSON.parse(this.responseText); } else { var data = JSON.parse(this.responseText).error.message; } } }; req.send();
下图是查询出的结果
相关文章推荐
- Dynamics CRM2016 Web API之Use custom FetchXML
- Dynamics CRM2016 Web API之Use custom FetchXML
- HTML <a> 标签
- echarts.js 做图表的插件
- Storyboard References
- 【H5适配一】使用X-UA-Compatible来设置IE浏览器兼容模式
- String字符串匹配javascript 正则表达式
- 细说JS的表达式和运算符
- html 素材表(模板、日期控件、对话框样式、 翻页 、框架)
- 取消chrome浏览器下input和textarea的默认样式
- JavaScript Array.concat() 函数详解
- 剑指offer:输出二叉树和为某一值的所有路径
- 和我一起学Effective Java之泛型
- css3动画animation属性
- 【笔记】 《js权威指南》- 第3章 类型、值和变量 - 3.10 变量作用域
- 前端JS十大常用正则表达式
- Jsp页面中判断字符串是否包含另一个字符串的两种方法,js判断包含的indexOf()方法
- css3动画
- Ext Js 4.x Tree从Json加载数据
- 用Javascript获取页面元素的位置