ディスカッション
NetSuiteの保存検索やレポートをマスターするための究極のガイドである分析センターを使用して、データの力を最大限に活用しましょう。複雑さを単純化し、組織の真の可能性を解き放ちます。今すぐ分析センターに参加して、新たな高みを目指しましょう!
New AI Community Guidelines. Please review and follow them to ensure AI use stays safe, accurate, and compliant.
Keep an eye out for upcoming NetSuite events, including meetups, workshops, and webinars. These sessions are a great way to connect with peers, learn from experts, and stay current on the latest NetSuite updates and best practices. Registration links are provided in each event.
SuiteScriptを用いてHTMLオブジェクトを電子メールの本文として送信する
適用
製品: NetSuite 2020.2
シナリオ
このサンプルコードでは、nlapiPrintRecordによりトランザクションを印刷してHTMLオブジェクトを生成する方法を示しています。結果のnlobjFileの値を電子メールの本文として取得し、nlapiSendEmailを使用してメールを送信します。
以下に、SuiteScript 2.0においても同様にする方法を例示します。
解決策
SuiteScript 1.0:
function email_html(request, response)
{
var type = 'TRANSACTION';
var id = 8;
var mode = 'HTML';
var properties = null;
var htmlbody = nlapiPrintRecord(type, id, mode, properties); //returns nlobjFile
var htmlbody = htmlbody.getValue();
nlapiLogExecution('debug', 'process', htmlbody);
var email = nlapiSendEmail('-5', '-5', 'Email inline HTML', htmlbody, null, null, null, null);
}
SuiteScript 2.0:
require(['N/render', 'N/email'],
function(render, email) {
function email_html() {
var transactionFile = render.transaction({
entityId: 8,
printMode: render.PrintMode.HTML
});
if (transactionFile.size < 10485760 ) {
タグ付けされた:
0