- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-16-2023 01:24 AM
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
var entries = current.comments.getJournalEntry(-1).split('\n\n');
//template.print('<div>'+entry+'</div><br>');
template.print('<ul style="list-style:none;" class = "mzc_comments_ul">');
for(var i = 0 ; i < 3 ; i++){
if(i<entries.length - 1){
template.print('<li class = "mzc_comments_li">');
var entry = entries[i];
var entry_obj = entry.split('\n');
var entry_info = entry_obj[0].split(' - ');
template.print('<div>');
template.print('<div class="info">'+entry_info[1]+'</div>');
template.print('<div class="info">'+entry_info[0].replace('KST','')+'</div>');
template.print('</div>');
template.print('<div class="comment">'+entry_obj[1].replace('[code]','').replace('[/code]','')+'</div>');
template.print('</li>');
}
}
template.print('</ul>');
})(current, template, email, email_action, event);
what is current, template, email, email_action, event in this script?
Please explain one by one.(current, template, email, email_action, event)
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-16-2023 01:34 AM
Hi @BoHyun Jung
current means the record on which your email is getting triggered, through this current object you can get the values of the columns of that record.
template means if you want to add any message through email script into the body then you need to use template.print("your message");
Email means if you want to add any optional email apart form the mail id which you've configured like setBody etc.,
Email Action means GlideRecordObject for the email notification
Event means the GlideRecord object of the event.
More details you can find in this page:
Please mark correct if my response has solved your query.
Cheers,
Mohammed Basheer Ahmed.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-16-2023 01:34 AM
Hi @BoHyun Jung
current means the record on which your email is getting triggered, through this current object you can get the values of the columns of that record.
template means if you want to add any message through email script into the body then you need to use template.print("your message");
Email means if you want to add any optional email apart form the mail id which you've configured like setBody etc.,
Email Action means GlideRecordObject for the email notification
Event means the GlideRecord object of the event.
More details you can find in this page:
Please mark correct if my response has solved your query.
Cheers,
Mohammed Basheer Ahmed.