locked
CRM 2013 - Javascript - OData Query For Query Details RRS feed

  • Question

  • Hi,

    I have the following Query

    function lineNumber() 
    {
      var accountPresent = false;
      var lineNumber = Xrm.Page.getAttribute("lineitemnumber").getValue();
      var Line = lineNumber.toString();
    
      var option = "$select=LineItemNumber&$filter=LineItemNumber eq '" + Line + "'";
    
      SDK.REST.retrieveMultipleRecords("QuoteProduct", option, retrieveAccountsCallBack, function(error) { alert(error.message); }, function(){});
    
      if(accountPresent == true)
      {
        alert("Hello");
      }
    
    }
    
    function retrieveAccountsCallBack(retrievedAccounts)
    {
      if(retrievedAccounts.length > 0)
      {
        accountPresent = true;
      }
      else
      {
      }
    }
    

    The purpose is to check if the line number exists in any previous products that are also associated with the quote so that overall a new quote number will exist. For now I just want to check if the query is working via if a account is returned from the query then a message box saying Hello will appear

    However when the query runs I get the following error;

    Error : 404 : not Found : Resource not found for the segment 'QuoteProductsSet'

    Any suggestions as what is wrong?

    Thanks, Shaun


    S.Harrison

    Thursday, July 17, 2014 2:49 PM

Answers

  • Hi Shaun,

    In OData query schema name should be used to retrieve record. Please use "QuoteDetail" instead of "QuoteProduct".

    SDK.REST.retrieveMultipleRecords("QuoteDetail", option, retrieveAccountsCallBack, function(error) { alert(error.message);

    HTH!

    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful" 

    Friday, July 18, 2014 4:35 AM