Skip to main content

@* Lightning Now! * Hi, 

We used to have a dev in house, but he's not working with us anymore. We have a JavaScript button that I need to replace to migrate to Lightning that I'm not sure exactly what it does. Does it only update the Account record? Could you please help translate to admin terms and suggest the best solution to replace it? #JS_Alternatives

 

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

 

function updateAccount(){ 

//Create a New Account and Set the Fields 

var accountToUpdate = new sforce.SObject("Account"); 

accountToUpdate.Id = "{!Account.Id}"; 

accountToUpdate.RADAR_Account_Status__c = "Trial"; 

 

//Save it to the Database 

var updateResult = sforce.connection.update([accountToUpdate]); 

 

//If the Update was Successful Refresh the Page 

if(updateResult[0].success === "true"){ 

location.reload(); 

} else{ 

alert(updateResult[0].errors.message); 

 

var status = "{!Account.RADAR_Account_Status__c}"; 

var provision = {!Account.Provisioning_Information_Complete__c}; 

var type = "{!Account.Trial_Type__c}"; 

 

if((status === "" || status === "Not Activated") && provision === 1 && type !== ""){ 

updateAccount(); 

} else { 

alert("Please complete the Initial Provisioning Information section and the Trial Type!"); 

}

 

Any help would be much appreciated!

Many thanks!

7 comentarios
0/9000