parts of the following example:
It is jlc_documento custom entity which is associated with contact and account entities. Contact and account being entities that are associated view and jlc_documento the lookups. (The lookup relationship created jlc_documento contact-lookup is jlc_documentocontactid and set up the account-jlc_documento relationship is jlc_documentoaccountid)
We wish to register more than 10 jlc_documentos for each contact and account registration.
The solution to this problem could be: var
client
nroRegistros var;
var authenticationHeader;
var xml;
if (crmForm.FormType == 1) {
if (crmForm.all.jlc_documentoaccountid.DataValue[0].id != null 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>" +
"<Fetch xmlns='http://schemas.microsoft.com/crm/2007/WebServices'>" +
"<fetchXml>&lt;fetch mapping='logical'&gt;" +
"&lt;entity name='jlc_documento'&gt;" +
"&lt;filter type='or'&gt;" +
"&lt;condition attribute='jlc_documentoaccountid' operator='eq' value='" + clienteId + "'/&gt;" +
"&lt;condition attribute='jlc_documentocontactid' operator='eq' value='" + clienteId + "'/&gt;" +
"&lt;/filter&gt;" +
"&lt;/entity&gt;" +
"&lt;/fetch&gt;</fetchXml>" +
"</Fetch>" +
"</soap:Body>" +
"</soap:Envelope>";
//Prepare the xmlHttpObject and send the request.
var xHReq = new ActiveXObject("Msxml2.XMLHTTP");
xHReq.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);
xHReq.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/crm/2007/WebServices/Fetch");
xHReq.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
xHReq.setRequestHeader("Content-Length", xml.length);
xHReq.send(xml);
//Capture the result was
resultXml = xHReq.responseXML;
/ / Check for errors.
was errorCount = resultXml.selectNodes ('/ / error'). Length;
if (errorCount! = 0) {msg =
was resultXml.selectSingleNode ('/ / description'). NodeTypedValue;
alert (msg);
} / / Process and display the results.
else {
/ / Capture the result og UnEncode IT.
was ResultSet = new String ();
ResultSet = resultXml.text;
resultSet.replace ('<','\u0026lt;');
resultSet.replace ('>', '>');
/ / Create an XML document That you-can parse.
was oXmlDoc = new ActiveXObject ("Microsoft.XMLDOM");
oXmlDoc.async = false;
/ / Load the XML document That speed the UnEncoded results.
oXmlDoc.loadXML (ResultSet);
/ / Display the results.
was oXmlDoc.getElementsByTagName results = ('result');
nroRegistros = results.length;
if (nroRegistros == 10) {
alert ("Make sure he registrado el número Máximo de Asociaciones");
window.close () ;}
}}}
0 comments:
Post a Comment