locked
How to count quote products related to a quote ?? RRS feed

  • Question

  • Hi all,

     

    is there anyway to count quote products related to a specific quote ???

     

    thanks in advance :)

    Sunday, November 14, 2010 12:31 PM

Answers

All replies

  • you can write a simple JS script, you can create an isv button button while will show you total records.

    also you can use Fetchxml for the same

    you can refer http://social.microsoft.com/Forums/en/crmdevelopment/thread/5cf019f8-adf4-45e7-aa0b-717b1db1c74d


    Mahain : http://mahenderpal.wordpress.com
    Sunday, November 14, 2010 2:00 PM
    Moderator
  • Dear Mahendar,

     

    I don't know what to say...but you're really an amazing person

     

    everytime i have a problem...you haVe a solution for it :)

     

    the problem is solved now i can get the number of retrieved records

     

    but i need the assign each retrieved value to an array element

     

    have you any idea how to do it ??

     

    suppose i have the following code:

     

    var authenticationHeader = window.opener.GenerateAuthenticationHeader();

    var xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + 

    "<soap:Envelope xmlns:soap="+

    "\"http://schemas.xmlsoap.org/soap/envelope/\" "+

    "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "+

    "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" + 

    authenticationHeader+

    "<soap:Body>" + 

    "<RetrieveMultiple xmlns="+

    "\"http://schemas.microsoft.com/crm/2007/WebServices\">" + 

    "<query xmlns:q1="+

    "\"http://schemas.microsoft.com/crm/2006/Query\" "+

    "xsi:type=\"q1:QueryByAttribute\">" + 

    "<q1:EntityName>quotedetail</q1:EntityName>" + 

    "<q1:ColumnSet xsi:type=\"q1:ColumnSet\">" + 

    "<q1:Attributes>" + 

    "<q1:Attribute>manualdiscountamount</q1:Attribute>" + 

    "</q1:Attributes>" + 

    "</q1:ColumnSet>" + 

    "<q1:Attributes>" + 

    "<q1:Attribute>quoteid</q1:Attribute>" + 

    "</q1:Attributes>" + 

    "<q1:Values>" + 

    "<q1:Value xsi:type=\"xsd:string\">{14447D88-6F5B-DF11-A3A7-00215A1F6AE3}</q1:Value>" + 

    "</q1:Values>" + 

    "</query>" + 

    "</RetrieveMultiple>" + 

    "</soap:Body>" + 

    "</soap:Envelope>";

     

    var xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");

    xmlHttpRequest.Open("POST","/mscrmservices/2007/CrmService.asmx",false);

    xmlHttpRequest.setRequestHeader("SOAPAction","http://schemas.microsoft.com/crm/2007/WebServices/RetrieveMultiple");

    xmlHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");

    xmlHttpRequest.setRequestHeader("Content-Length", xml.length);

    xmlHttpRequest.send(xml);

    var resultXml = xmlHttpRequest.responseXML.xml;

     

    var doc = new ActiveXObject("MSXML2.DOMDocument");

    doc.async = false;

    doc.loadXML(resultXml);

    var m = doc.selectNodes("//q1:manualdiscountamount");

     

    if(m!=null)

    alert(m.length);

     

     

    this code returns: (2)

     

    i need to assign each manualdiscountamount to an array element

     

    any help will be appreciated

    Sunday, November 14, 2010 2:36 PM
  • you can try like this

    var doc = new ActiveXObject("MSXML2.DOMDocument");
    doc.async = false;
    doc.loadXML(resultXml);
    var businessEntities = doc.getElementsByTagName('BusinessEntity');
    var ResultArray=new Array();
    for (i=0;i < businessEntities.length;i++)
     {

      if (businessEntities[i].selectSingleNode('./q1:manualdiscountamount') != null)
       {
       
      ResultArray[i]= businessEntities[i].selectSingleNode('./q1:manualdiscountamount');
    }
    else
    ResultArray[i]=0;
    }


    Mahain : http://mahenderpal.wordpress.com
    Monday, November 15, 2010 3:48 AM
    Moderator