How to get Last Modified Date and Last Modified By inside Email Template in Netsuite?

Hi All,

As in earlier post I mentioned about field ids for last modified by and last modified date ,
in this post I want to show how to get these field in Email Template for custom record.

Netsuite don't support CRMSDK, as CRMSDK templates are deprecated as of Version 2015 Release 1.
So convert your existing CRMSDK templates to scriptable templates within the UI.

Now first thing you have to use ${customrecord.fieldIdOfYourField},
Use same format you can get any field text you want.
If you want to get Internalid i.e integer value then use
 ${customrecord.fieldIdOfYourField.id}

this will give you internal id of field which are List or Record.Don't use on other field as they can come blank or with some error also.

Now to get Last modified and last modified by
use below format

Updated On : ${customrecord.lastmodified}
Updated By: ${customrecord.lastmodifiedby}

Add Subject and enter body for email id as per your need.

Now if you want to send email using this email template with the help of Script then you have to do following :

var emailMerger = nlapiCreateEmailMerger(EmailTemplateId);
                        emailMerger.setCustomRecord('customRecordTypeId', CustomRecordId);
                        var mergeResult = emailMerger.merge();
                        var emailSubject = mergeResult.getSubject();
                        var emailBody = mergeResult.getBody();
  nlapiSendEmail(SenderId, ToEmail, emailSubject , emailBody , null,null,null);     


Please Note :
The nlobjEmailMerger object is supported in all server-side scripts.

 Please let me know if you need any help in Email Template, Merger API or Fields.

Thanks
Abhi
Netsuite Guru
                      

Comments