ディスカッション

NetSuiteの保存検索やレポートをマスターするための究極のガイドである分析センターを使用して、データの力を最大限に活用しましょう。複雑さを単純化し、組織の真の可能性を解き放ちます。今すぐ分析センターに参加して、新たな高みを目指しましょう!

NetSuite の始め方 | クライアント・スクリプト: saveRecord(scriptContext)

NetSuite の始め方 | SuiteScript タイプの概要の記事のすべてのタイプのSuiteScriptについて説明したところで、様々なタイプのクライアント・スクリプトに焦点を当てます。saveRecord関数は、実はフォームが公式に保存される前に、「送信」ボタンが押された後に実行されます。これにより、データを検証または変更して、データがコミットされる前に特定の条件が満たされるようにする最後の機会を提供します。

saveRecord関数の簡単な例を次に示します。

/**
 * @NApiVersion 2.x
 * @NScriptType ClientScript
 * @NModuleScope SameAccount
 */
define(['N/error','N/currentRecord','N/ui/dialog'],
function(error,currentRecord,dialog) {
    /**
     * Function to be executed after page is initialized.
     *
     * @param {Object} scriptContext
     * @param {Record} scriptContext.currentRecord - Current form record
     * @param {string} scriptContext.mode - The mode in which the record is being accessed (create, copy, or edit)
     *
     * @since 2015.2
     */
    function saveRecord(scriptContext) {
var currentRecord = scriptContext.currentRecord;
var fieldId = scriptContext.fieldId;
        if (!currentRecord.getValue({fieldId: 'memo'})){
            dialog.alert({
title: 'MISSING_REQ_ARG',
message: 'Please enter all the necessary fields on the salesorder before saving'
})
return false;
}else{
return true;

Richard James Uri - SuiteCloud | WMS Tech | SuiteCommerce Advanced

----

Admin Tips.gif
タグ付けされた:

ようこそ!

サインイン

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

登録

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

リーダーボード

コミュニティの達人

第 1 四半期 (1月~3月 2026)

今週のリーダー

今月のリーダー

歴代リーダー