You need to sign in to do that
Don't have an account?
Kevinp211
S-Control in a solution
Hello,
We are trying to create a custom S-control on a solution record that will fill in certain fields when selected. I created the following S-control but for some reason it does not work. No errors are given it simply displays the "Solution updating" message and nothing else happens. If I comment out the line in blue below the code will function and return to the original solution record but of course this does not update the solution.
Any help would be greatly appreciated. Thanks!
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Update Field</title>
<script src="https://www.salesforce.com/services/lib/ajax/beta3.3/sforceclient.js?browser=false" type="text/javascript"></script>
<script language="javascript">
<!--
//Page initialization
function initPage() {
<html>
<head>
<title>Update Field</title>
<script src="https://www.salesforce.com/services/lib/ajax/beta3.3/sforceclient.js?browser=false" type="text/javascript"></script>
<script language="javascript">
<!--
//Page initialization
function initPage() {
sforceClient.registerInitCallback(pageSetup);
sforceClient.setLoginUrl("https://test.salesforce.com/services/Soap/u/7.0");
sforceClient.init("{!API_Session_ID}", "{!API_Partner_Server_URL_70}", true);
}
sforceClient.setLoginUrl("https://test.salesforce.com/services/Soap/u/7.0");
sforceClient.init("{!API_Session_ID}", "{!API_Partner_Server_URL_70}", true);
}
function goBack(Id) {
// This brings me back to the Objects overview page if an Object Id is given.
var r = "{!Scontrol_URL}".split(/salesforce.com/);
var whichId = "";
if (Id != null) whichId = Id;
var returnUrl = r[0] + "salesforce.com/"+whichId;
window.parent.parent.location.href = returnUrl;
}
// This brings me back to the Objects overview page if an Object Id is given.
var r = "{!Scontrol_URL}".split(/salesforce.com/);
var whichId = "";
if (Id != null) whichId = Id;
var returnUrl = r[0] + "salesforce.com/"+whichId;
window.parent.parent.location.href = returnUrl;
}
function pageSetup() {
var myCase = new Sforce.Dynabean("Solution");
var myCase = new Sforce.Dynabean("Solution");
myCase.set("Id", "Solution_ID");
myCase.set("Solution_SolutionNote","Test Solution Template");
sforceClient.Update(myCase);
sforceClient.Update(myCase);
goBack("{!Solution_ID}");
}
//-->
</script>
</head>
<body onload="initPage();">
}
//-->
</script>
</head>
<body onload="initPage();">
Solution Updating......
</body>
</html>
</body>
</html>
myCase.set("Solution_SolutionNote","Test Solution Template");
You should use:
myCase.set("SolutionNote","Test Solution Template");
However, in general it's good practice to put this kind of stuff inside throw try/catch blocks so you can see what kind of errors you get.
Good luck, Steve Bower