You need to sign in to do that
Don't have an account?

S-Control sample code to copy field contents?
Hello. I need to write an S-Control to copy the contents of a custom phone number field in a Contact record to the standard Home Phone field in the same Contact record. (I have a custom Home Phone field in Leads and it won't feed into the standard Home Phone in Contact during the conversion.)
I have general programming experience with VBA, T-SQL, and tiny bit of Ruby, but I don't know where to start with S-Controls. Can anyone point me to S-Control sample code that does this kind of copy function?
Thanks
David
I have general programming experience with VBA, T-SQL, and tiny bit of Ruby, but I don't know where to start with S-Controls. Can anyone point me to S-Control sample code that does this kind of copy function?
Thanks
David
<script src="https://www.salesforce.com/services/lib/ajax/beta3.3/sforceclient.js" type="text/javascript"></script>
<script type="text/javascript">
// get session id and initialize the sforceClient object
sforceClient.init("{!API_Session_ID}", "{!API_Partner_Server_URL_70}");
//check everything is ok
if (sforceClient.getSessionId().indexOf("!API_Session_ID") != -1) {
displayMessage("You are not logged in");
} else {
//Update the contact
var recObject = new Sforce.Dynabean("Contact");
recObject.set("id", "{!Contact_ID}");
recObject.set("Phone", "{!Contact_Custom_Phone}");
var saveResults = sforceClient.Update(recObject);
parent.location.href = "/{!Contact_ID}";
}
-->
</script>
<script src="https://www.salesforce.com/services/lib/ajax/beta3.3/sforceclient.js" type="text/javascript"></script>
<script type="text/javascript">
// get session id and initialize the sforceClient object
sforceClient.init("{!API_Session_ID}", "{!API_Partner_Server_URL_70}");
//check everything is ok
if (sforceClient.getSessionId().indexOf("!API_Session_ID") != -1) {
displayMessage("You are not logged in");
} else {
//Update the contact
var recObject = new Sforce.Dynabean("Contact");
recObject.set("id", "{!Contact_ID}");
recObject.set("HomePhone", "{!Lead_Home_Phone}");
var saveResults = sforceClient.Update(recObject);
parent.location.href = "/{!Contact_ID}";
}
-->
</script>