+ Start a Discussion
ChitraChitra 

Scontrol Create

Hey..

For the problem I had with long query string, I tried to send the data as POST instead of Get. I m trying to create a Subcase and Associate it with the parent case by creating one more SObject.

I can successfully create the Object , but I m not able to get the new ID that is created.  Does anyone know how to parse the SOAP response and extract the ID that is sent back ??

Thanks,

Chitra

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</head>
<body>

<script language="javascript">
<!--
var msxml = new ActiveXObject("Msxml2.XMLHTTP.3.0");
var sessionid = "{!API_Session_ID}";
var apiServer = "{!API_Enterprise_Server_URL_50}";


var createCommand = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
createCommand += "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">";
createCommand += "<soapenv:Header>";
createCommand += "<ns1:SessionHeader soapenv:mustUnderstand=\"0\" xmlns:ns1=\"urn:enterprise.soap.sforce.com\">";
createCommand += "<ns2:sessionId xmlns:ns2=\"urn:enterprise.soap.sforce.com\">" + sessionid + "</ns2:sessionId>";
createCommand += "</ns1:SessionHeader>";
createCommand += "</soapenv:Header>";
createCommand += "<soapenv:Body>";
createCommand += "<create xmlns=\"urn:enterprise.soap.sforce.com\">";
createCommand += "<sObjects xsi:type=\"ns3:Account\" xmlns:ns3=\"urn:sobject.enterprise.soap.sforce.com\">";
createCommand += "<ns3:Name>Testing MM</ns3:Name>";
createCommand += "</sObjects>";
createCommand += "</create>";
createCommand += "</soapenv:Body>";
createCommand += "</soapenv:Envelope>";

msxml.open("POST", apiServer, false);
msxml.setRequestHeader("Content-Type","text/xml");
msxml.setRequestHeader("SOAPaction","create");
msxml.send(createCommand);
var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.3.0");
xmlDoc.loadXML(msxml.responseText);
xmlDoc.setProperty("SelectionNamespaces", "xmlns:sf='urn:sobject.enterprise.soap.sforce.com'");
xmlDoc.setProperty("SelectionLanguage", "XPath");
var objNodeList = xmlDoc.documentElement.selectNodes("//result/Id");
if(objNodeList!=null)
{
   var urll= objNodeList.text;
}

var returll="https://na1.salesforce.com"+urll;
window.parent.parent.location.href = returll;
//-->

</script>
</body>
</html>