You need to sign in to do that
Don't have an account?
AVictorio
Lead: Custom Link S-Control to Update Field
Hello out there. I think I've read every post and just about all documentation I could on the Ajax tool kit and Eclipse. I'm not a programer by any means so please bear with me as I'm just looking for some guidance.
I'm trying to set up an S-Control that I can call using a custom link on the Lead object.
I need the S-Control to update custom field "Queue__c" with the string value "SupplierRelations". (simple right?)
Below is the code I'm using but I cannot for the life of me get it to work. Can someone please tell me what I'm doing wrong?
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title></title> <script language="javascript" src="https://www.salesforce.com/services/lib/ajax/beta3.3/sforceclient.js—browser=true" type="text/javascript"></script> <script id="clientEventHandlersJS" language="javascript"> <!-- function initPage() { sforceClient.registerInitCallback(setup); sforceClient.setLoginUrl("https://www.salesforce.com/services/Soap/u/7.0"); sforceClient.init("{!API_Session_ID}", "{!API_Partner_Server_URL_70}", true); } //Use this function as the entry point for your DHTML and JAVASCRIPT processing function setup() { var lead = new Sforce.Dynabean("Lead") lead.set("Queue__c","SupplierRelations"); lead.save(); } //--> </script> </head> <body onload="initPage()"> </body> </html>
- You need a semi-colon ; at the end of var lead = new Sforce.Dynabean("Lead")
- Make sure you are populating all of the required fields before you save the record.
Use var saveResult = lead.save(); to get the result of the save method and see if it was successful.Code:
I must still be doing something wrong (sorry to be such a newbie!). Above is the code I tried and it seems to run its course but nothing gets updated. Any suggestions?
alert ( saveResult.toString() )
to see what is going on with your call to the toolkit / API