Sending email on Weekdays using combination of workflow and script.
(1) Create a custom field that will hold the Day today. Navigate to
Customization > Lists, Records, & Fields > Transaction Body Fields > New
Create new field, input necessary details, type = Free Form Text
(2) Create a Workflow > Create State > Create new Set Field Value action
Trigger On: Entry
Formula: Day Today=TO_CHAR( {today}, 'DAY' )
Result: The value of the custom field will hold MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY.
(3) Create a Client Script that similar to the code snippet below:
function sendEmail_save(){
var day_today = nlapiGetFieldValue('custbody_day_today');
if(day_today != 'SATURDAY' && day_today != 'SUNDAY'){
nlapiSendEmail(-5, 'myet@netsuite.com', 'Subject', 'Email Body', null, null, null, null);
}
return true;
}
NOTE: This sample script will not attach the email to the record.
No comments:
Post a Comment