Dynamics CRM 4.0 a long script

Source: Internet
Author: User
If (isnull (crmform. All. new_pricelevel_kzid) = false) {var jmbmc = crmform. All. new_pricelevel_kzid.datavalue [0]. Name; var xml = "" +? XML version = \ "1.0 \" encoding = \ "UTF-8 \"?> "+" <Soap: envelope xmlns: Soap = \ "external" xmlns: xsi = \ "external" xmlns: XSD = \ "http://www.w3.org/2001/xmlschema\"> "+ generateauthenticationheader () + "<soap: Body>" + "<retrievemultiple xmlns = \" comment ">" + "<query xmlns: Q1 = \" http://schemas.microsoft.com/crm/2006/query\ "xsi: TYPE = \" Q1: que Rybyattribute \ ">" + "<Q1: entityname> new_pricelevel_kz </Q1: entityname>" + "<Q1: columnset xsi: TYPE = \" Q1: columnset \ ">" + "<Q1: Attributes>" + "<Q1: attribute> new_pricelevel </Q1: attribute>" + "</Q1: attributes> "+" </Q1: columnset> "+" <Q1: Attributes> "+" <Q1: attribute> new_name </Q1: attribute> "+" </Q1: Attributes> "+" <Q1: values> "+" <Q1: Value xsi: TYPE = \ "XSD: string \ ">" + jmbmc + "</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; try {var id = resultxml. getelementsbytagname ("Q1: new_pricelevel") [0]. childnodes [0]. nodevalue; var MC = resultxml. getelementsbytagname ("Q1: new_pricelevel") [0]. getattribute ("name"); var lookupdata = new array (); // create an object add to the array. vaR lookupite M = new object (); // set the ID, typename, and name properties to the object. lookupitem. id = ID; lookupitem. typename = 'pricelevel '; lookupitem. name = MC; // Add the object to the array. lookupdata [0] = lookupitem; // set the value of the lookup field to the value of the array. crmform. all. pricelevelid. datavalue = lookupdata; // start try {var xml = "" + "<? XML version = \ "1.0 \" encoding = \ "UTF-8 \"?> "+" <Soap: envelope xmlns: Soap = \ "external" xmlns: xsi = \ "external" xmlns: XSD = \ "http://www.w3.org/2001/xmlschema\"> "+ generateauthenticationheader () + "<soap: Body>" + "<retrievemultiple xmlns = \" comment ">" + "<query xmlns: Q1 = \" http://schemas.microsoft.com/crm/2006/query\ "xsi: TYPE = \" Q1: que Ryexpression \ ">" + "<Q1: entityname> productpricelevel </Q1: entityname>" + "<Q1: columnset xsi: TYPE = \" Q1: allcolumns \ "/>" + "<Q1: distinct> false </Q1: distinct>" + "<Q1: Criteria>" + "<Q1: filteroperator> and </Q1: filteroperator> "+" <Q1: conditions> "+" <Q1: Condition> "+" <Q1: attributename> pricelevelid </Q1: attributename> "+" <Q1: Operator> equal </Q1: Operator> "+" <Q1: values> "+" <Q1: Value xsi: TYPE = \ "XSD: String \"> "+ ID +" </Q1: value> "+" </Q1: values> "+" </Q1: condition> "+" </Q1: conditions> "+" </Q1: criteria> "+" </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.c OM/CRM/2007/WebServices/retrievemultiple "); XMLHttpRequest. setRequestHeader ("Content-Type", "text/XML; charset = UTF-8"); XMLHttpRequest. setRequestHeader ("Content-Length", XML. length); XMLHttpRequest. send (XML); try {var resultxml = XMLHttpRequest. responsexml; // total var amount = resultxml. getelementsbytagname ("Q1: amount") [0]. childnodes [0]. nodevalue; crmform. all. totalamount. datavalue = Number (amount);} catch (exce Ption) {} var xml2 = "" + "<? XML version = \ "1.0 \" encoding = \ "UTF-8 \"?> "+" <Soap: envelope xmlns: Soap = \ "external" xmlns: xsi = \ "external" xmlns: XSD = \ "http://www.w3.org/2001/xmlschema\"> "+ generateauthenticationheader () + "<soap: Body>" + "<retrievemultiple xmlns = \" comment ">" + "<query xmlns: Q1 = \" http://schemas.microsoft.com/crm/2006/query\ "xsi: TYPE = \" Q1: queryexpression \ ">" + "<Q1: entityname> new_pricelevel_kz </Q1: entityname>" + "<Q1: columnset xsi: TYPE = \" Q1: allcolumns \ "/>" + "<Q1: distinct> false </Q1: distinct>" + "<Q1: Criteria>" + "<Q1: filteroperator> and </Q1: filteroperator> "+" <Q1: conditions> "+" <Q1: Condition> "+" <Q1: attributename> new_pricelevel </Q1: attributename> "+" <Q1: Operator> equal </Q1: Operator> "+" <Q1: values> "+" <Q1: Value xsi: TYPE = \ "XSD: string \ ">" + ID + "</Q1: value>" + "</Q1: values>" + "</Q1: Condition>" + "</Q1: conditions> "+" </Q1: Criteria> "+" </query> "+" </retrievemultiple> "+" </soap: body> "+" </soap: envelope> "+" "; var xmlhttprequest2 = new activexobject (" msxml2.xmlhttp "); xmlhttprequest2.open (" Post ", & quot;/mscrmservices/2007/crmservice. asmx ", false); xmlhttprequest2.setrequestheader (" soapaction "," http://schemas.microsoft.com/crm/2007/WebServices/RetrieveMultiple "); xmlhttprequest2.setrequestheader (" Content-Type "," text/XML; charset = UTF-8 "); response ("Content-Length", xml2.length); xmlhttprequest2.send (xml2); try {var resultxml2 = xmlhttprequest2.responsexml; var JF = Response ("Q1: new_jmbjf") [0]. childnodes [0]. nodevalue; // This credit crmform. all. new_bcjf.datavalue = Number (Jf);} catch (exception) {crmform. all. new_bcjf.datavalue = Number (0) ;}} catch (exception) {}// end} catch (exception ){}}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.