20100518日做的订单存根
if(IsNull(crmForm.all.new_nsrsbh)==false){
//获取纳税人识别号
var nsrsbh = crmForm.all.new_nsrsbh.DataValue;
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\">" +
GenerateAuthenticationHeader() +
" <soap:Body>" +
" <RetrieveMultiple xmlns=\"http://schemas.microsoft.com/crm/2007/WebServices\">" +
" <query xmlns:q1=\"http://schemas.microsoft.com/crm/2006/Query\" xsi:type=\"q1:QueryExpression\">" +
" <q1:EntityName>account</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_nsrsbh</q1:AttributeName>" +
" <q1:Operator>Equal</q1:Operator>" +
" <q1:Values>" +
" <q1:Value xsi:type=\"xsd:string\">"+nsrsbh+"</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.com/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;
//企业名称
var nsrmc = resultXml.getElementsByTagName("q1:name")[0].childNodes[0].nodeValue;
var lookupData = new Array();
// Create an object to add to the array.
var lookupItem= new Object();
// Set the id, typename, and name properties to the object.
lookupItem.typename = 'account';
lookupItem.name =nsrmc
// Add the object to the array.
lookupData[0] = lookupItem;
// Set the value of the lookup field to the value of the array.
crmForm.all.customerid.DataValue = lookupData;
crmForm.all.name.DataValue=nsrmc+"产品报订单";
crmForm.all.customerid.disabled=true;
crmForm.all.new_nsrsbh.disabled=true;
}
catch(Exception ){
alert('纳税人信息查询不到');
crmForm.all.new_nsrsbh.DataValue="";
return;
}
}
else{
return;
}
posted on 2010-05-19 17:19 HelloHongfu 阅读(194) 评论(0) 收藏 举报
浙公网安备 33010602011771号