ディスカッション
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にて、顧客レコードのメッセージサブリストの前回メッセージ日付を基づいてカスタムフィールドの値を設定する
適用
製品: NetSuite 2021.2
シナリオ
ユーザーイベントスクリプトの送信前の機能を介して、顧客レコードのメッセージサブリストの前回メッセージ日付を基づいてカスタムフィールドの値を設定する
解決策
SuiteScript 1.0のユーザーイベントスクリプト:
function userEventBeforeSubmit(type) { var customerId = nlapiGetRecordId(); var customerSearch = nlapiSearchRecord("customer", null, [ ["internalid", "anyof", customerId] ], [ new nlobjSearchColumn("messagedate", "messages", null).setSort() ]); var getMaxDateLength = customerSearch.length; var getResult = customerSearch[getMaxDateLength - 1]; var getColumn = getResult.getAllColumns(); var getMaxDate = getResult.getValue(getColumn[0]); nlapiSetFieldValue('custentity_email_maxdate', getMaxDate, true, true); }
SuiteScript 2.0 ユーザーイベントスクリプト:
/** * NApiVersion 2.x * NScriptType UserEventScript */ define(['N/currentRecord', 'N/search'], function (currentRecord, search) { /** * Function definition to be triggered before record is loaded. * * @param {Object} scriptContext * @param {Record} scriptContext.newRecord - New record * @param {Record} scriptContext.oldRecord - Old record * @param {string} scriptContext.type - Trigger type * Since 2015.2 */ function beforeSubmit(scriptContext) { var customerId = currentRecord.id; var columns = search
タグ付けされた:
0