ディスカッション

NetSuiteの保存検索やレポートをマスターするための究極のガイドである分析センターを使用して、データの力を最大限に活用しましょう。複雑さを単純化し、組織の真の可能性を解き放ちます。今すぐ分析センターに参加して、新たな高みを目指しましょう!
New AI Community Guidelines. Please review and follow them to ensure AI use stays safe, accurate, and compliant.
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を使用して注文書が終了とされた後に電子メールを送信する

編集済:Jun 2, 2025 2:48PM SuiteCloud / カスタマイズ

適用

製品: NetSuite 2024.2

シナリオ

トランザクションが終了に変更されるタイミングでスクリプトとワークフローは実行させることはできません。これは、Enhancement 216263に記載されています。

beforeLoadで実行されるユーザーイベントスクリプトを作成します。

注意: Enhancementについては次の記事をご参照ください。 10054 Voting for Enhancements.

解決策

SuiteScript 1.0:

function userEventBeforeLoad(type, form, request){function userEventBeforeLoad(type, form, request){

          var id = nlapiGetRecordId(); // Get Record Id
    var transactiontype = nlapiGetRecordType(); // Get Record Type
    var status = nlapiGetFieldValue('status'); // Get the order status
    var salesrep = nlapiGetFieldValue('salesrep'); // Get the sales rep

    if (status == 'Closed' ) // check if status is closed
        {
            nlapiSendEmail(nlapiGetContext().getUser(), salesrep, 'Close order' + transactiontype + id   , 'Your order has now been closed.' ); // send email
                 }
}

SuiteScript 2.0:

/**
* @NApiVersion 2.x
* @NScriptType UserEventScript
* @NModuleScope SameAccount
*/
define(['N/record','N/email'], function (record,email){
   function beforeLoad(scriptContext) {
       var recId = scriptContext.request.parameters.id;
       var soRecord = record.load({
           type: record.Type.SALES_ORDER,

ようこそ!

サインイン

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

登録

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

リーダーボード

コミュニティの達人

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

今週のリーダー

今月のリーダー

歴代リーダー