I am trying to send an email (from Classic Email Template) on button click with validation and field update. But when I click the button, it does nothing.

Can you please help me what's wrong?


var c_email = '{!CustomObject__c.Email__c}'; 
var c_name = '{!CustomObject__c.Name}'; 
var personAccount = '{!CustomObject__c.Person_Account__c}'; 
var dateCompleted = '{!CustomObject__c.Completion_Date__c}'; 

if(c_email == '' || c_name == '' || personAccount == '' || dateCompleted == null) { 

alert('Please complete required fields before sending Form.'); 

} else { 


var cToUpdate = new sforce.SObject("CustomObject__c");

cToUpdate.Status__c = 'Form sent'; 
cToUpdate.Date_Form_Sent__c = new Date(); 

  • can you check if there are any errors on the console? – rahul gawale Jul 18 at 6:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.