ディスカッション

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.

SuiteScript 2.0を用いて時間比較条件に一致するレコードを検索

適用

製品:  NetSuite 2022.1



シナリオ

特定の期間に作成されたレコードの検索を作成したい。

現在の時刻を確認し、それを目的の時間範囲と比較して、時間差を検索のフィルターとして使用するSuiteScriptを作成します。



解決策

SuiteScript 2.0での例:

 
//get current time 
var dateNow = new Date().getTime(); 
 
//Verify dateNow in desired DateTime format 
var tempDateNow = new Date(dateNow); 
var tempDateNowX = format.format({value:tempDateNow, type: format.Type.DATETIME}); 
 
//sample 15 minute time range converted into DateNow format 
var comparetime = 15 * 60 * 1000; 
 
//comparison 
var base = dateNow-comparetime; 
 
//base variable converted to 'date' 
var BT = new Date(base); 
 
//display desired DateTime format 
var BTX = format.format({value: BT, type: format.Type.DATE}) + ' ' + format.format({value: BT,type: format.Type.TIMEOFDAY}); 

BTX変数は、createddateフィールドの検索フィルタの値として使用します。結果がBTXの値(現在の時間から15分を引いたもの)のONまたはAFTERで作成されたケース・レコードを返す場所。

次に、SuiteScript 2.0検索のサンプル・スニペットと前述の比較を示します。

 
require(['N/search', 'N/format'], function (search,format){ 
 
//get current time 
var dateNow = new Date

ようこそ!

サインイン

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

登録

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

リーダーボード

コミュニティの達人

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

今週のリーダー

今月のリーダー

歴代リーダー