ディスカッション

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 でRestletを使用し、NetSuiteファイルキャビネットからファイルをダウンロードして移動する

編集済:Jul 25, 2024 8:14AM SuiteCloud / カスタマイズ

適用

製品:  NetSuite 2022.1

シナリオ

開発者は、NetSuiteファイルキャビネットからファイルIDを取得するためのRestletを作成できます。ファイルIDは、ダウンロードして特定のフォルダに移動するためのRestlet呼び出し中にパラメータとして渡すことができます。以下のレストレットの例は、3つの操作をサポートしています。 PostパラメータはJSON形式で渡すことができます。ダウンロードできるファイルの最大サイズは10 MBであることに注意してください。

解決策

//処理可能なファイル内部IDを返します

{

"operation": "getFileIds"

}

//関連ファイルを宛先フォルダに移動します

{

"operation": "moveFile",

"id": xxx

}

//関連ファイルの内容を返します

{

"operation": "getFile",

"id": xxx

}

/**

* @NApiVersion 2.x

* @NScriptType Restlet

*/

var SAVED_SEARCH = 'customsearch_files_to_download';

var DESTINATION_FOLDER = 509;

define(['N/file', 'N/search'],

function (file, search) {

function post(dataIn) {

var operation = dataIn.operation;

if (operation == 'getFile') {

if (dataIn.id)

return getFile(dataIn.id);

else

return 'Request not processed. Details: ' + JSON.stringify(dataIn);

}

if (operation == 'getFileIds') {

return getFileIds();

}

if (operation == 'moveFile') {

if (dataIn.id)

return moveFile(dataIn.id);

else

return 'Request not processed. Details: ' + JSON.stringify(dataIn);

}

return 'Operation: ' + operation + ' not found.';

タグ付けされた:

ようこそ!

サインイン

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

登録

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

リーダーボード

コミュニティの達人

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

今週のリーダー

今月のリーダー

歴代リーダー