[英]dynamics crm 2016 - Web API query- dynamic values
I'm trying to form a query to retrieve related record properties in the new Dynamics CRM (2016) Web API. 我正在尝试形成一个查询以检索新的Dynamics CRM(2016)Web API中的相关记录属性。 But I am unable to pass the GUID value dynamically unlike in CRM 2011-2015. 但是,与CRM 2011-2015不同,我无法动态传递GUID值。
function getRelatedEntityStartAndEndDates(){
var parentOpportunity = Xrm.Page.getAttribute("rb_opportunityid").getValue()[0].id;
var clientUrl = Xrm.Page.context.getClientUrl();
var query = clientUrl +"/api/data/v8.0/opportunities(5e0f714-a0c6-e511-812b-061cb19131a3)?$select=rb_enddate,rb_startdate";
alert(query);
}
Since the new query doesn't have quotes around GUID, I'm unable to pass on the parentOpportunity dynamically. 由于新查询在GUID周围没有引号,因此我无法动态传递parentOpportunity 。
You want to strip off the curly braces, like this: 您要剥离花括号,如下所示:
var query = clientUrl +"/api/data/v8.0/opportunities(" + parentOpportunity.slice(1, -1) + ")?$select=rb_enddate,rb_startdate";
As an aside, the CRM Rest builder is a great tool to help you construct REST queries. 顺便说一句,“ CRM Rest”构建器是一个很好的工具,可以帮助您构建REST查询。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.