ディスカッション

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.

注文書からシリアル/ロット番号付きアイテムを含む配送を作成する

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

適用

製品:  NetSuite 2020.2



シナリオ

注文書の承認後に配送レコードを自動的に作成するサンプル・ユーザー・イベント・スクリプトです。

注文書には、ロット/シリアル番号を使用する在庫詳細サブレコードがあるアイテムが含まれています。
UIと同様に、シリアル/ロット番号は在庫詳細サブレコードに既に入力されています。シリアル/ロット番号の値は、注文書と同じです。



解決策

下記コードを使用するユーザーイベントスクリプトを作成します。

 
/** 
 * NApiVersion 2.x 
 * NScriptType UserEventScript 
 * NModuleScope SameAccount 
 */ 
define(['N/record'], 
    /** 
     * @param {record} 
     *            record 
     */ 
    function (record) { 
    function afterSubmit(scriptContext) { 
        var eventType = scriptContext.type; 
        var newRecId = scriptContext.newRecord.id; 
        var newRecStatus = scriptContext.newRecord.getValue({ 
            fieldId: 'status' 
        }); 
        if (newRecStatus == 'Pending Approval') { //check if Pending Approval as script would throw an error when creating a new SO 
            log.debug({ 
                title: 'record ID', 
                details: newRecId 
            }); 
            var recordObj = record.transform({ 
                fromType: record.Type.SALES_ORDER, 
                fromId: newRecId, 
                toType: record.Type.ITEM_FULFILLMENT 
            }); 
 
            var objSubRecord = recordObj.getSublistSubrecord({ 
                sublistId: 'item', 
                fieldId: 'inventorydetail', 
                line: 0 
            }); 
 
            objSubRecord.setSublistValue({ 
                sublistId: 'inventoryassignment', 
                fieldId: 'quantity', 
                value: 1, 
                line: 0 
            }); 
 
            objSubRecord.setSublistValue({ 
                sublistId: 'inventoryassignment', 
                fieldId: 'issueinventorynumber

ようこそ!

サインイン

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

登録

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

リーダーボード

コミュニティの達人

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

今週のリーダー

今月のリーダー

歴代リーダー