ディスカッション

スイート全体に組み込まれたAI機能は、データをより迅速に分析し、より優れた意思決定を促進する独自の考察を生成できるようにすることで、生産性を向上させ、リーダーに利便性をもたらします。オラクルのAI機能がどのように役立つかについては、これらのオンデマンド・ウェビナーをご覧ください。

AIを用いた自動化で請求書処理を合理化

AIを用いた考察を使用して、計画と予測を迅速化
NetSuiteの保存検索やレポートをマスターするための究極のガイドである分析センターを使用して、データの力を最大限に活用しましょう。複雑さを単純化し、組織の真の可能性を解き放ちます。今すぐ分析センターに参加して、新たな高みを目指しましょう!
NetSuite Release 2025.1リリース・ノートは、こちらからダウンロードできます。
Nominate Your Peers for NetSuite Support Community's Choice of the Quarter! Submit your nomination today.
Intelligent Payment Automation version 1.0.3 is now available in the SuiteApp Marketplace. The SuiteApp, powered by BILL, lets you automate payments, manage vendor details, and bank account information within NetSuite. Learn more

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

編集済:Jun 2, 2025 2:53PM SuiteCloud

NetSuite の始め方| SuiteScript の種類の概要 の記事で、すべてのタイプのSuiteScriptについて説明しましたので、様々なタイプのクライアント・スクリプトに焦点を当てます。validateLineは、ユーザーがレコードにコミットされる直前に、サブリスト内の行を追加または更新しようとするときに使用されます。これはゲートキーパーとして機能し、サブリストのデータが事前定義済の条件またはビジネス・ルールを満たしていることを確認します。この検証により、保存する前にサブリストに入力されたデータの整合性と正確性が保証されます。

予想される戻り値:

  • true: サブリスト行が有効で、追加または更新が成功します。
  • false:検証に失敗しました。サブリストへの追加または更新は防止されます。

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

/**
 * @NApiVersion 2.x
 * @NScriptType ClientScript
 * @NModuleScope SameAccount
 */
define(['N/error','N/currentRecord'],
function(error,currentRecord) {
    /**
     * Validation function to be executed when sublist line is committed.
     *
     * @param {Object} scriptContext
     * @param {Record} scriptContext.currentRecord - Current form record
     * @param {string} scriptContext.sublistId - Sublist name
     *
     * @returns {boolean} Return true if sublist line is valid
     *
     */
    function validateLine(scriptContext) {
var currentRecord = scriptContext.currentRecord;
        var fieldId = scriptContext.fieldId;
        var sublistId = scriptContext.sublistId;
if (sublistId === 'item') {
            var currentQuantity = currentRecord.getCurrentSublistValue({
                sublistId: 'item',
                fieldId: 'quantity'
            });
            // Ensure quantity is less than 3
            if (currentQuantity > 3) {
                var currentDesc = currentRecord.setCurrentSublistValue({
sublistId: 'item',
fieldId: 'description',
value: 'Quantity must be less than 3.'

Richard James Uri - SuiteCloud | WMS Tech | SuiteCommerce Advanced

----

Admin Tips.gif

ようこそ!

サインイン

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

登録

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

リーダーボード

コミュニティの達人

第4四半期 (Oct-Dec 2025年)

今週のリーダー

今月のリーダー

歴代リーダー