function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Tom SineTom Sine 

Custom Button to Update a Date Field and Trigger an Email Alert

I have a custom button that completes a date field with the current date (see below).  When this date is filled in on the record I then need an email to be sent.  I have a workflow setup for this when the date field is populated without the button, but I cannot get it to work when the button is used.  Any recommendations?

{!REQUIRESCRIPT("/soap/ajax/20.0/connection.js")} 
 
var newRecords = [];
 
var c = new sforce.SObject("Engineering_Request_for_Custom_Quote__c"); 
c.id ="{!Engineering_Request_for_Custom_Quote__c.Id}";
c.Project_Manager_Request__c = new Date();
newRecords.push(c); 
 
result = sforce.connection.update(newRecords); 
 
window.location.reload();

Thanks
Tom Sine
Best Answer chosen by Tom Sine
Ashish_Sharma_DEVSFDCAshish_Sharma_DEVSFDC
Anyway its an update operation on 'Engineering_Request_for_Custom_Quote__c' object , so workflow should fire if it matches evaluation criteria .
Please check debug logs.