ディスカッション
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.
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 1.0を使用して動的なリストを持つカスタムフィールドを作成する
適用
製品: NetSuite 2022.1
シナリオ
仕入先支払請求書(支払請求書作成時に発注書から入力される)上でソースとなる選択フィールドがあり、それは承認時に従業員に請求書をルーティングするワークフローで使用されます。WV支払請求書所有者ロールを持つ従業員のみが、支払請求書を承認することができます。しかし、購入者は現在、このロールを持たない従業員を選択しているため、請求書は行き詰まり、承認されないまま終了しています。
解決策
- ユーザーイベントスクリプトの作成
- 読み込み前関数の下に、以下の条件の検索を作成します。
注:これは、保存検索を作成することによっても可能です。- フィルター:
- ロール: 内部IDのいずれか
- WV 支払請求書所有者を選択
- ロール: 内部IDのいずれか
- 列:
- 内部ID
- Altname
- addFieldを使用して選択フィールドを作成する
- フィルター:
- 作成した検索を実行し、結果を取得
- addSelectOptionを使用して作成したフィールドに結果を追加する
- クライアントスクリプトを呼び出す
- 読み込み前関数の下に、以下の条件の検索を作成します。
コードスニペット:
var searchResults = nlapiLoadSearch('employee','customsearch69').runSearch();
var arr = searchResults.getResults(0,1000);
var field = form.addField('custpage_testscriptfield', 'select', 'Bill Owner Script');
field.addSelectOption('','');
for(var i = 0; i < arr.length; i++) {
var getCol = arr[i].getAllColumns();
var id = arr[i].getValue(getCol[0]);
var text = arr[i].getValue(getCol[1]);
field.addSelectOption(id, text);
}
- クライアントスクリプトを作成する
- Field Changed関数にて、ユーザーイベントスクリプトで作成したフィールドが変更されたことを評価するIf構文を作成します。
- custbody_nsts_gaw_bill_ownerの値をスクリプトで作成したフィールドの値に設定します。
コードスニペット:
form.setScript('customscript203');
nlapiLogExecution("DEBUG", "start", "calling client script");
if(name == 'custpage_testscriptfield'){
nlapiLogExecution("DEBUG", "start", "starting client script");
nlapiLogExecution("DEBUG", "GET VAL", nlapiGetFieldValue("custpage_testscriptfield"));
nlapiSetFieldValue("custbody21", nlapiGetFieldValue("custpage_testscriptfield"), true, true);
nlapiLogExecution("DEBUG", "GET custbody21", nlapiGetFieldValue("custbody21"));
}
タグ付けされた:
0