问题描述
如何通过javascript检索报价的所有产品(=报价详细信息)?
How can I retrieve all products (= quote details) of a quote by javascript?
我尝试了以下代码,但这不起作用:
I have tried following code, but that doesn't work:
id = quoteid
var options = "$select=ProductId&$filter=QuoteId eq (guid'"+ id + "'";
SDK.REST.retrieveMultipleRecords("QuoteDetail", options, ebcont.crm.quote._successQuoteDetailMultiRetrieve, function(error) {alert(error.message);}, ebcont.crm.quote._multiRetrieveQuoteComplete);
我总是收到以下消息:
Error: 400: Bad Request: operator 'eq' is no compatible with operatortyp 'Microsoft.Crm.Metadata.ComplexTypeInstance'1 ... and 'System.Guid'
有人知道哪里出了问题吗?
Does somebody have any idea what is wrong?
感谢
推荐答案
尝试将ID添加到 QuoteId
:
id = quoteid
var options = "$select=ProductId&$filter=QuoteId/Id eq (guid'"+ id + "'";
SDK.REST.retrieveMultipleRecords("QuoteDetail", options, ebcont.crm.quote._successQuoteDetailMultiRetrieve, function(error) {alert(error.message);}, ebcont.crm.quote._multiRetrieveQuoteComplete);
这是区分大小写的,因此也要小心。我建议为XrmToolBox使用FetchXmlBuilder插件,首先测试REST oData调用。它具有查看其余URL的选项。只要您的javascript生成确切的url,您就应该不错。
It is case sensitive so be careful about that as well. I'd recommend using the FetchXmlBuilder plugin for the XrmToolBox to test REST oData calls first. It has an option to view the rest url. As long as your javascript generates the exact url, you should be good.
使用新的(在2016年)CRM WebAPI端点我还建议Jason Lattimer的CRM Rest Builder:
With the new (in 2016) CRM WebAPI endpoint I'd also recommend Jason Lattimer's CRM Rest Builder: https://github.com/jlattimer/CRMRESTBuilder/releases
这篇关于ms crm 2011使用javascript检索报价详细信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!