ディスカッション

NetSuiteの保存検索やレポートをマスターするための究極のガイドである分析センターを使用して、データの力を最大限に活用しましょう。複雑さを単純化し、組織の真の可能性を解き放ちます。今すぐ分析センターに参加して、新たな高みを目指しましょう!
New AI Community Guidelines. Please review and follow them to ensure AI use stays safe, accurate, and compliant.
Update: Narrative Insights has been restored and is now available.

Narrative Insights is Temporarily Unavailable due to an Infrastructure Issue. Learn how This Impacts Your Account and What to Expect While the Feature is Disabled.

SuiteScriptを用いてHTMLオブジェクトを電子メールの本文として送信する

編集済:Jul 25, 2024 7:05AM SuiteCloud / カスタマイズ

適用

製品:  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 ) {

             
タグ付けされた:

ようこそ!

サインイン

完全な詳細を表示するには、サインインしてください。

登録

アカウントがありませんか?ここをクリックして始めましょう!

リーダーボード

コミュニティの達人

第2四半期 (4月~6月 2026)

今週のリーダー

今月のリーダー

歴代リーダー