Skip to main content

Ajax Try Catch Button Example

{!REQUIRESCRIPT("/soap/ajax/32.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/32.0/apex.js")}

if (!window.console) console = {log: function() {}};

/*
sforce.debug.trace=open; //debug helper
sforce.debug.open();
*/

 try{
var result = sforce.apex.execute("DA","Authenticate",{Request:"Attempt Authentication"});
console.log("DEBUG result: " + result);
console.log("DEBUG result.sessionId: " + result.sessionId);

}catch(error) {
     console.log(error);
     alert(error);
  }

Comments

Popular posts from this blog

Override Name in the Salesforce Cloud Console

Service Cloud Console HyperLink Opens new window outside of the console, Opens new tab inside the console. HYPERLINK("javascript:if(typeof(srcUp)=='function') {srcUp('/" & Id & "?isdtp=vw');}"+ " else {window.location.href='/" & Id & "'}", User__r.FirstName + ' ' + User__r.LastName, "_self" ) Checks if the srcUp exists and if it does, you're in the console.