ディスカッション
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.
定期スクリプトを介して保存検索で返したレコードを更新する
適用
製品: NetSuite 2022.1
シナリオ
保存検索で返したレコードは定期スクリプトで更新できます。例え、保存検索結果での注文書のカスタムフォームフィールドを変更します。
使用制限を守るために、nlapiYieldScript() を使用します。Answer Id: 10481 スクリプトの使用単位制限を参照します。しかし、SuiteScript 2.0に定期スクリプトタイプではnlapiYieldScript()はもう使用不可になりました。大数量のデータにはマップ/レデュースを使用して推奨します。
解決策
サンプル:nlapiYieldScript()を使用するSuiteScript 1.0の定期スクリプト:
function scheduled(type) {
var soid = nlapiSearchRecord('transaction', 'customsearch_xxx'); //作成した保存検索をロードする
var context = nlapiGetContext();
var usage_limit = context.getRemainingUsage();
nlapiLogExecution('debug', '注文書のID', soid.length);
if (soid) {
if (usage_limit < 100) {
nlapiYieldScript();
}
for (var i = 0; i < soid.length; i++) {
var record = soid[i];
nlapiLogExecution('debug', '注文書のID', record.getId());
nlapiSubmitField('salesorder', record.getId(), 'memo', 'テスト');
}
}
}
サンプル:SuiteScript 2.0の定期スクリプト:
define(['N/record', 'N/search'], function (record, search) {
function execute(scriptContext) {
var soSearch = search.load({
id: 'customsearch_xxx'
}) //作成した保存検索をロードする
soSearch.run().each(function (result) {
var soId = record.submitFields({
type: record.Type.SALES_ORDER,
タグ付けされた:
0