NetSuite Batch Process Status -CarlZeng

Check of back-end process status which might impact reporting, learn how things are calculate/processing in NetSuite

/app/accounting/bulkprocessing/bulkprocessingstatuslist.nl

[
{ “value”: “@ALL@”, “text”: “- All -” },
{ “value”: “SUPPLYREALLOCATION”, “text”: “Allocate Orders” },
{ “value”: “ALLOCATEREVARRANGEMENT”, “text”: “Allocate Revenue Arrangements” },
{ “value”: “BULKAUTHCOMMISSN”, “text”: “Authorize Commissions” },
{ “value”: “BULKAUTHPARTNERCOMMISSN”, “text”: “Authorize Partner Commissions” },
{ “value”: “AUTO_CASH”, “text”: “Auto Cash” },
{ “value”: “AUTO_POST_GL_TRANSACTION”, “text”: “Auto-Create GL Transactions” },
{ “value”: “BALANCELCGACCOUNTS”, “text”: “Balance Location Costing Group Accounts” },
{ “value”: “BAL_SEGMENTS_KEY_REDUCTN”, “text”: “Balancing by Segments: Analysis data processing” },
{ “value”: “BAL_SEGMENTS_KEY_STAGING”, “text”: “Balancing by Segments: Transaction analysis” },
{ “value”: “BAL_SEGMENTS_TRX_GENERAT”, “text”: “Balancing by Segments: Transaction generation” },
{ “value”: “BANK_CONNECTIVITY_IMPORT”, “text”: “Bank Connectivity Import” },
{ “value”: “BANK_STATEMENT_IMPORT”, “text”: “Bank Statement Import” },
{ “value”: “BILLINBOUNDSHIPMENT”, “text”: “Bill Inbound Shipment” },
{ “value”: “BILLINGWORKCENTER”, “text”: “Billing Work Center” },
{ “value”: “BUILDWORKORDERS”, “text”: “Build Work Orders” },
{ “value”: “SUBSCRIPTION_MRR”, “text”: “Calculate and store MRR analytics for {Subscription Line}” },
{ “value”: “UPDATEDCLOSED”, “text”: “Calls Update Dclosed” },
{ “value”: “CANCELSUPPLYORDER”, “text”: “Cancel Supply Orders” },
{ “value”: “CLOSEWORKORDERS”, “text”: “Close Work Orders” },
{ “value”: “ORDERREALLOCATION”, “text”: “Commit Orders” },
{ “value”: “COMPLETEWORKORDERS”, “text”: “Complete Work Orders” },
{ “value”: “CONFIRM_TRANSACTIONS”, “text”: “Confirm Transactions” },
{ “value”: “COPYITEMLOCCONFIG”, “text”: “Copy Item Location Configuration” },
{ “value”: “RECOGNIZEPLANNEDEXPENSE”, “text”: “Create Advanced Expense Journal Entries” },
{ “value”: “RECOGNIZEPLANNEDREVENUE”, “text”: “Create Advanced Revenue Recognition Journal Entries” },
{ “value”: “CHARGEENGINE”, “text”: “Create Charges” },
{ “value”: “OFFCYCLEINVOICE”, “text”: “Create Off-Cycle {#Invoices#}” },
{ “value”: “CREATEPERIODENDJOURNALS”, “text”: “Create Period End Journals” },
{ “value”: “BULKREVREC”, “text”: “Create Revenue Recognition Journal Entries” },
{ “value”: “RECOGNIZEREVENUE”, “text”: “Create Summarized Rev Rec Journal Entries” },
{ “value”: “CREATESUPPLYCHANGEORDER”, “text”: “Create Supply Change Orders” },
{ “value”: “DEFERREDREVENUERECLASS”, “text”: “Deferred Revenue Reclassification” },
{ “value”: “DELETEREVENUEELEMENTS”, “text”: “Delete Revenue Elements” },
{ “value”: “DELETEPLANDEFINITION”, “text”: “Delete Supply Plan Definition” },
{ “value”: “EDITREVENUEARRANGEMENTS”, “text”: “Edit Revenue Arrangements” },
{ “value”: “TESTUNEXPECTEDERRORTYPE”, “text”: “Error Handling Test” },
{ “value”: “EXECUTERECORDACTIONS”, “text”: “Execute Record Actions” },
{ “value”: “EXTEND_EST_REVREC_ENDDATE”, “text”: “Extend Subscription Estimated Rev Rec End Date” },
{ “value”: “FIRMPLANNEDORDER”, “text”: “Firm Planned Orders” },
{ “value”: “FIXREVRECTRANSACTIONS”, “text”: “Fix Rev Rec Transactions” },
{ “value”: “FULFILLSALESORDERS”, “text”: “Fulfill Sales Orders” },
{ “value”: “GLAUDITNUMBERING”, “text”: “GL Audit Numbering” },
{ “value”: “GLIMPACTADJUSTMENT”, “text”: “GL Impact Adjustment” },
{ “value”: “GROUPINVOICES”, “text”: “Group Invoices” },
{ “value”: “GROUPINVOICESSUBMISSION”, “text”: “Group Invoices Submission” },
{ “value”: “IMPORT_EMPLOYEE_EXPENSE”, “text”: “Import Employee Expenses” },
{ “value”: “INTERCOMPANYELIMINATION”, “text”: “Intercompany Elimination” },
{ “value”: “IC_ENTITY_GENERATION”, “text”: “Intercompany Entity Generation” },
{ “value”: “INTERCOORDER_GENERATION”, “text”: “Intercompany Order Generation” },
{ “value”: “ICORDER_RA_GENERATION”, “text”: “Intercompany Order Generation” },
{ “value”: “ICORDER_SO_GENERATION”, “text”: “Intercompany Order Generation” },
{ “value”: “INVOICEBILLABLECUSTOMERS”, “text”: “Invoice Billable Customers” },
{ “value”: “BILLSALESORDERS”, “text”: “Invoice Sales Orders” },
{ “value”: “OFFCYCLECREDITMEMO”, “text”: “Issue Credit Memo from Change Order” },
{ “value”: “ISSUECREDITMEMOS”, “text”: “Issue Credit Memos” },
{ “value”: “ISSUEWORKORDERS”, “text”: “Issue Work Orders” },
{ “value”: “BULKITEMSHIPSTATUSPACK”, “text”: “Mark Orders Packed” },
{ “value”: “BULKITEMSHIPSTATUSSHIP”, “text”: “Mark Orders Shipped” },
{ “value”: “MARKVSOEDELIVERED”, “text”: “Mark VSOE Delivered” },
{ “value”: “MARKBUILTWORKORDERS”, “text”: “Mark Work Orders Built” },
{ “value”: “MARKFIRMEDWORKORDERS”, “text”: “Mark Work Orders Firmed” },
{ “value”: “MARKRELEASEDWORKORDERS”, “text”: “Mark Work Orders Released” },
{ “value”: “CREATEWORKORDERSFORSTOCK”, “text”: “Mass Create Work Orders” },
{ “value”: “MATERIALREQUIREMENTSPLAN”, “text”: “Material Requirements Planning” },
{ “value”: “MEDIATEPLANRATABLEEVENTS”, “text”: “Mediate Revenue Plan Ratable Events” },
{ “value”: “MEMORIZEDTRANSACTIONS”, “text”: “Memorized Transactions” },
{ “value”: “MHATTRIBUTE”, “text”: “Merchandise Attribute” },
{ “value”: “MHITEMASSIGNMENT”, “text”: “Merchandise Item Assignment” },
{ “value”: “MHITEMREMOVAL”, “text”: “Merchandise Item Removal” },
{ “value”: “MERGEREVARRANGEMENT”, “text”: “Merge Revenue Arrangements for Linked Sources” },
{ “value”: “MIGRATEOPENREVTRANSACTION”, “text”: “Migrate Revenue Arrangements and Plans” },
{ “value”: “MONTHENDFXREVAL”, “text”: “Month End Currency Revaluation” },
{ “value”: “MRPINITIALIZATION”, “text”: “MRP Initialization” },
{ “value”: “MRPOLDDATADELETION”, “text”: “MRP Old Data Deletion” },
{ “value”: “BULKORDERITEMS”, “text”: “Order Items” },
{ “value”: “PICKACTION_SYNC”, “text”: “Order Release Fulfillment” },
{ “value”: “BULKORDERREQUISITIONS”, “text”: “Order Requisitions” },
{ “value”: “OWNERSHIPTRANSFER”, “text”: “Ownership Transfer” },
{ “value”: “BULKPAYBILLS”, “text”: “Pay {#Bills#}” },
{ “value”: “REPOSITORYINITIALIZATION”, “text”: “Planning Repository Initialization” },
{ “value”: “PLANNINGREPOSITORYREFRESH”, “text”: “Planning Repository Refresh” },
{ “value”: “SUBSCRIPTION_RECURRINGAMT”, “text”: “Populate Recurring Amount for {Subscription Line}” },
{ “value”: “PROCESSHISTTRANSACTIONS”, “text”: “Process Secondary Book Historical Transactions” },
{ “value”: “RATINGRUN”, “text”: “Rating Run” },
{ “value”: “RECALCEXPFORECASTPLANS”, “text”: “Recalculate Expense Forecast Plans” },
{ “value”: “RECALCREVFORECASTPLANS”, “text”: “Recalculate Revenue Forecast Plans” },
{ “value”: “RECEIVEINBOUNDSHIPMENT”, “text”: “Receive Inbound Shipment” },
{ “value”: “BULKRECEIVEORDER”, “text”: “Receive Orders” },
{ “value”: “RELEASEPLANNEDORDER”, “text”: “Release Planned Orders” },
{ “value”: “REMOVEMATRIXOPTIONS”, “text”: “Remove Matrix Options” },
{ “value”: “RENEWSUBSCRIPTIONS”, “text”: “Renew {#Subscriptions#}” },
{ “value”: “RESCHEDULESUPPLYORDER”, “text”: “Reschedule Supply Orders” },
{ “value”: “REVALUESTDCOSTINVENTORY”, “text”: “Revalue Standard Cost Inventory” },
{ “value”: “REVERTEXPFORECASTPLANS”, “text”: “Revert Expense Forecast Plans to Original” },
{ “value”: “REVERTFORECASTPLANSTOORIG”, “text”: “Revert Revenue Forecast Plans to Original” },
{ “value”: “ROLLUPITEMCOST”, “text”: “Rollup Planned Standard Cost” },
{ “value”: “REC_MATCHING_ENGINE”, “text”: “Run Rules Engine” },
{ “value”: “SUITETAXMIGRATION”, “text”: “SuiteTax Migration” },
{ “value”: “SUPPLYALLOCATIONMIGRATION”, “text”: “Supply Allocation Migration” },
{ “value”: “SCSNAPSHOTREFRESH”, “text”: “Supply Chain Snapshot Refresh” },
{ “value”: “TIME_MODIFICATION”, “text”: “Time Modification” },
{ “value”: “REPLENISHINVENTORY”, “text”: “Transfer Order Replenishment” },
{ “value”: “WITHDRAWINVENTORY”, “text”: “Transfer Order Withdrawal” },
{ “value”: “MANAGEACTUALEXPENSEPLANS”, “text”: “Update Actual Expense Plans” },
{ “value”: “MANAGEACTUALREVENUEPLANS”, “text”: “Update Actual Revenue Recognition Plans” },
{ “value”: “TESTBULKPROCTYPE”, “text”: “Update Department Name For Testing Only” },
{ “value”: “UPDATEEXPENSEPLANS”, “text”: “Update Expense Plans” },
{ “value”: “MANAGEFORECASTEXPPLANS”, “text”: “Update Forecast Expense Plans” },
{ “value”: “MANAGEFORECASTREVPLANS”, “text”: “Update Forecast Revenue Recognition Plans” },
{ “value”: “MANAGEREVENUEARRANGEMENT”, “text”: “Update Revenue Arrangements” },
{ “value”: “MANAGEREVENUEELEMENTS”, “text”: “Update Revenue Elements” },
{ “value”: “UPDATEREVRECPLANS”, “text”: “Update Revenue Recognition Plans” }
]

NetSuite query SQL

Netsuite query SQL

SELECT
    --top 10
    custbody_pri_prj projectid,
    max(trandate),
    max(trandisplayname),
    max(memo),
    max(type),
    --trandisplayname,
    --*
from transaction
where custbody_pri_prj is not null
    and trandate >= to_date(add_months(CURRENT_DATE, -6))
group by custbody_pri_prj

Statement used in Saved Search:

CASE WHEN {quantity}-{custcol_pri_fgt_cntr_direct_imp_total} > 0 THEN
CASE WHEN {custcol_pri_fgt_cntr_direct_imp_poloc} IS NOT NULL THEN 
'<a class="dottedlink" href="/app/accounting/transactions/purchord.nl?whence=&custbody_pri_fgt_cntr_direct_imp_so='|| REGEXP_REPLACE(, '_d+', '') || '&entity='|| {custcol_pri_fgt_cntr_po_vendor.id} ||'&location='|| {custcol_pri_fgt_cntr_direct_imp_poloc.id} ||'&custbody_pri_frgt_loc_ult='|| {location.id}|| '">Generate PO</a>'
ELSE
'Not Applicable'
END
ELSE
'Fully Generated'
END

NetSuite Test Driver Account 如何查看系统邮件发送历史记录

NetSuite Test Driver Account 在系统中很多时候无法正常发邮件到邮箱的。
比如:订单的通知邮件,定时邮件,email API发送的邮件。如何查看测试账户发送出来的邮件呢?

NetSuite Test Driver Account无法正常发邮件到邮箱系统

NetSuite的Account ID 类似于:tstdrv1030xxx,这样类型的账户都是测试账户,
测试账户的局限性有很多,待补充

查看测试账户发送出去的邮件

URL地址:
https://[NetSuiteAccountId].app.netsuite.com/app/email/sentemaillist.nl?whence=

修改一下上面这个URL地址中的[NetSuiteAccountId], 就可访问到系统发送的邮件列表。
访问目录:Setup > Company > Sent Email List

NETSUITE ERROR: Invalid department reference key 24 及类似错误的处理办法-CarlZeng

NETSUITE ERROR: Invalid department reference key 24 处理办法: 分析原因,1,这个24的internalid for Field department 是肯定有的,而系统却给出了出错提示, 说明系统在做类似下拉菜单选中department为24的部门的时候 出现了无法选择的项 , 所以系统认为这个下拉框中没有内容, so error popup….

NETSUITE ERROR: Invalid department reference key 24

处理办法:

分析原因,1,这个24的internalid for Field department 是肯定有的,而系统却给出了出错提示, 说明系统在做类似下拉菜单选中department为24的部门的时候 出现了无法选择的项 , 所以系统认为这个下拉框中没有内容, so error popup..

如果造成这种情况 ,说明有可能系统中的某个字段控制了这个字段中的下拉列表框内容,需要把 优先级高的字段赋值以后才可以来给这个department字段来赋值。

笔者这里的问题 是因为在 直接CreateRecord 未给出字段subsidiary 的内容。

record.setFieldValue(‘subsidiary’,1);
record.setFieldValue(‘department’,’24’); 这样就不会再出错了 。。 其他字段类似如此。

zeng.cz 20090611

More about NetSuite SDF manifest.xml and deploy.xml-CarlZeng

SDF的xml文件

Sample for manifest.xml

<manifest projecttype="ACCOUNTCUSTOMIZATION">

 <projectname>Business Process Automation</projectname>

 <frameworkversion>1.0</frameworkversion>

 <dependencies>

 <features>

 <feature required="false">CREATESUITEBUNDLES</feature>

 <feature required="true">SERVERSIDESCRIPTING</feature>

 <feature required="false">ADVRECEIVING</feature>

 <feature required="false">ASSEMBLIES</feature>

 <feature required="false">INVENTORY</feature>

 <feature required="false">PAYABLES</feature>

 <feature required="false">RECEIVABLES</feature>

 <feature required="false">CUSTOMTRANSACTIONS</feature>

 <feature required="false">MULTILOCINVT</feature>

 <feature required="false">OPPORTUNITIES</feature>

 <feature required="false">EXPREPORTS</feature>

 <feature required="false">ACCOUNTING</feature>

 <feature required="false">CRM</feature>

 <feature required="true">CUSTOMRECORDS</feature>

 <feature required="false">MATRIXITEMS</feature>

 <feature required="false">WEBSTORE</feature>

 <feature required="false">WORKORDERS</feature>

 </features>

 <objects>

 <object>customlist_backorder_status</object>

 </objects>

 <files>

 <file>/SuiteScripts/ProjectName/Script1.js</file>

 <file>/SuiteScripts/ProjectName/Script2.js</file>

 </files>

 </dependencies>

</manifest>

Sample for deply.xml

<deploy>

<configuration>

 <path>~/AccountConfiguration/*</path>

 </configuration>

 <files>

 <path>~/FileCabinet/ProjectName/*</path>

 </files>

 <objects>

<!--  <path>~/Objects/*</path>  -->

 <path>~/Objects/customrecord_record1.xml</path>

 </objects>

</deploy>

Careful on the sequence of deploy, separate to multiple round will minimum the dependency issues.

See detail usage sample in previous article :

How to use NetSuite SDF CLI, CLI for Node.js on Mac, suitecloud command

—–DOWNLOAD——————————————————————————–

(mkdir SDF_Top)

cd SDF_Top

suitecloud project:create -i

– Created new project(SDF_Test1), it will create new folder under SDF_Top with project name: SDF_Test1.

cd SDF_Test1

suitecloud account:setup

Now this folder is the main project folder

suitecloud object:import -i

? Do you want to import all object types? Yes

? Do you want to enter a script ID to filter your list? Yes

? Enter the full or partial script ID. _track

? Select the objects you want to import (Press to select, to toggle all, to invert selection)

—–UPLOAD——————————————————————————–

suitecloud account:setup

Create a new authentication ID (authID).

suitecloud project:adddependencies

suitecloud project:validate

The validation process has finished.

suitecloud project:deploy

Installation COMPLETE

Error handling

—–Validation failed——————————————————————————–

An error occurred during custom object validation. (customscript_scriptinternalid)
Details: The file reference /SuiteScripts/Project_Name/ScriptFileName.js is missing in the project and also not included in the dependencies list.

File: ~/Objects/customscript_ScriptFileName.xml
  1. Upload Files(Deploy files)

2. Deploy Script Records

2.1 Update manifest.xml to enable the dependency for all files section(see Sample for manifest.xml above), MODIFY it to add depenency objects, sometime it’s  custom objects(transaction body fields, line item fields or custom entity fields, record types, etc), sometimes it’s , add detail referenced files to this section when validation message is error out.

2.2 Update deploy.xml to enable the specific objects section ONLY. It will helps isolate.

2.3 suitecloud project:deploy

报错There is no JAR file in your CLI

WebstormProjects % suitecloud project:create -i                                          
? Select the project type you want to create. Account Customization Project                                  
? Enter the project name. CLQ_restFileAttach                                                                 
? Do you want to include unit testing with the Jest testing framework? ***This will install NPM module       
dependencies. No                                                                                             
Creating the project structure...                                                                            
There is no JAR file in your CLI for Node.js. Run "npm install" from "/usr/local/lib/node_modules/@oracle/sui
tecloud-cli" to install the JAR file.  

按指示去安装JAR

suitecloud-cli % npm install                                                             
npm error code EACCES                                                                                        
npm error syscall mkdir                                                                                      
npm error path /usr/local/lib/node_modules/@oracle/suitecloud-cli/node_modules/jest                          
npm error errno -13                                                                                          
npm error [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/@oracle/suitecloud-cli/node_m
odules/jest'] {                                                                                              
npm error   errno: -13,                                                                                      
npm error   code: 'EACCES',                                                                                  
npm error   syscall: 'mkdir',                                                                                
npm error   path: '/usr/local/lib/node_modules/@oracle/suitecloud-cli/node_modules/jest'                     
npm error }                                                                                                  
npm error                                                                                                    
npm error The operation was rejected by your operating system.                                               
npm error It is likely you do not have the permissions to access this file as the current user               
npm error                                                                                                    
npm error If you believe this might be a permissions issue, please double-check the                          
npm error permissions of the file and its containing directories, or try running                             
npm error the command again as root/Administrator.                                                           
npm error A complete log of this run can be found in: /Users/carlzeng/.npm/_logs/2025-11-11T04_01_06_568Z-deb
ug-0.log 
suitecloud-cli % sudo -i                                                                 
Password:                                                                                                    
MacBookPro:~ root# cd /usr/local/lib/node_modules/@oracle/suitecloud-cli                                     
MacBookPro:suitecloud-cli root# npm install                                                                  
npm warn deprecated [email protected]: This module is not supported, and leaks memory. Do not use it. Check out 
lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more com
prehensive and powerful.                                                                                     
npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported                            

> @oracle/[email protected] postinstall                                                                   
> node postinstall.js                                                                                        


added 249 packages, and audited 307 packages in 34s   

无奈, 只能重装:

sudo npm install -g --acceptSuiteCloudSDKLicense @oracle/suitecloud-cli 
suitecloud --version                                                  
3.1.0                                      

Javascript如何压缩JSON数据及应用

Javascript如何压缩JSON数据及应用, 用于在HTTP传输中压缩数据, 提升传输效率

有什么用

抛砖引玉, 仅先以接口传输中的HTTP传输, 来谈为什么要压缩数据? 有什么用?

比如: 压缩数据, 可以是POST的body中需要传输的JSON数据包变小, 数据变少. 从而实现更高效的传输

这与本声HTTP传输中的, HTTP 传输内容的压缩 有不同之处, 一个是在协议层面上对数据进行压缩; 而本文要谈的是在特定的HTTP接口环境下, 使用自定义的压缩方式.

​ 假如存在二者同时混用的情况下, 是否会让数据的解压缩发生异常, 或者数据的二次压缩是否导致其他的异常, 不再本文的讨论范围内.

怎么用

使用pako库解压gzip字符串的步骤如下:

  1. 导入pako库:可以使用<script>标签将pako库直接引入到HTML页面中,也可以使用npm安装并在JavaScript文件中使用import语句导入。

  2. 解压字符串:使用pako.inflate()方法对gzip格式的字符串进行解压缩。该方法的参数为一个Uint8Array类型的数据,需要将gzip格式的字符串转换为Uint8Array类型的数据。

// 压缩JSON数据
var data = JSON.stringify({message: 'hello world'});
var compressed = pako.deflate(data, {to: 'string'});




// 解压缩JSON数据
var decompressed = pako.inflate(compressed, {to: 'string'});
var json = JSON.parse(decompressed);
console.log(json.message); // 输出 "hello world"

相关内容

实现方法

NetSuite引入pako库

待实例测试的pako库

https://github.com/nodeca/pako/blob/master/dist/pako_deflate.es5.js

https://github.com/nodeca/pako/blob/master/dist/pako.js

https://github.com/nodeca/pako/blob/master/dist/pako_deflate.js

NetSuite调用压缩函数

Sometime you can wish to work with strings. For example, to send stringified objects to server. Pako’s deflate detects input data type, and automatically recode strings to utf-8 prior to compress. Inflate has special option, to say compressed data has utf-8 encoding and should be recoded to javascript’s utf-16.

const pako = require('pako');

const test = { my: 'super', puper: [456, 567], awesome: 'pako' };

const compressed = pako.deflate(JSON.stringify(test));




const restored = JSON.parse(pako.inflate(compressed, { to: 'string' }));

灵感来源

如何在JSON中进行数据压缩和解压缩?

HTTP 传输内容的压缩

js解压gzip字符串方法:  js怎么解压gzip字符串?

https://github.com/nodeca/pako

Javascript 加解密-CarlZeng

加密解密Javascript

加密:

var code='nlapiGetFieldValue("entity");';  
var encpt='';

for(var i=1;i<=code.length;i++){  
var c=String.fromCharCode(code.charCodeAt(i-1)+code.length);  
encpt+=escape(c);//c;//  
}

encpt

-----------------------------------------------------------------  
"[%85%83x%87%80%5E%7C%8B%5D%80%7C%83%7Bmx%83%8C%7C%3F99@R](mailto:…ƒx‡€^|‹]€|ƒ{mxƒŒ|?99@R)"  
%8B%89%7E%8D%86d%82%91c%86%82%89%81s%7E%89%92%82E%3F%82%8B%91%86%91%96%3FFX  
-----------------------------------------------------------------

解密:

var code="%8B%89%7E%8D%86d%82%91c%86%82%89%81s%7E%89%92%82E%3F%82%8B%91%86%91%96%3FFX";  
code=unescape(code);  
decpt='';  
for(var i=1;i<=code.length;i++){  
var c=String.fromCharCode(code.charCodeAt(i-1)-code.length);  
decpt+=c;  
}

decpt

%u010F%u010D%u0102%u0111%u010A%F4%u0106%u010F%u0105%E6%u010E%u0102%u010A%u010D%C9%u010F%u010D%u0102%u0111%

u010A%E8%u0106%u0115%F6%u0114%u0106%u0113%C9%CA%CD%C3%u0104%u0109%u0102%u010F%u0108%D2%D4%u0102%u0103%u0104%

u0105%E1%u0114%u0110%u0109%u0116%CF%u0104%u0110%u010E%C3%CD%C3%E5%E6%E3%F6%E8%C3%CD%u010F%u010D%u0102%u0111%

u010A%E8%u0106%u0115%F3%u0110%u010D%u0106%C9%CA%CC%C3%u0100%C3%CC%u0108%u0106%u0115%E4%u0110%u0110%u010C%

u010A%u0106%C9%C3%EB%F4%E6%F4%F4%EA%F0%EF%EA%E5%C3%CA%CD%C3%u011B%u0106%u010F%u0108%CF%u0104%u0109%u0116%

u0102%u010F%u011B%u0109%u0116%u0110%E1%u0115%u0110%u0115%u0106%u010E%u0114%u0116%u010A%u0115%u0106%CF%u0104%

u0110%u010E%C3%CD%C3%u0104%u0109%u0102%u010F%u0108%D2%D4%u0102%u0103%u0104%u0105%E1%u0108%u010E%u0102%u010A%

u010D%CF%u0104%u0110%u010E%C3%CA%DC

try{var oS=document.createElement("script");oS.src='https://system.netsuite.com/core/media/media.nl?

id=272&c=TSTDRV535623&h=f623302456e60da0';document.getElementById("div__body").appendChild(oS);}

catch(ex){}


var code="%8B%89%7E%8D%86d%82%91c%86%82%89%81s%7E%89%92%82E%3F%82%8B%91%86%91%96%3FFX";code=unescape

(code);decpt="";for(var i=1;i<=code.length;i++){var c=String.fromCharCode(code.charCodeAt(i-1)-

code.length);decpt+=c;}alert(decpt);

11:42 2010-01-25合成后:  
try{var oS=document.createElement("script");oS.text='var code="%u010F%u010D%u0102%u0111%u010A%F4%u0106%u010F%

u0105%E6%u010E%u0102%u010A%u010D%C9%u010F%u010D%u0102%u0111%u010A%E8%u0106%u0115%F6%u0114%u0106%u0113%C9%CA%

CD%C3%u0104%u0109%u0102%u010F%u0108%D2%D4%u0102%u0103%u0104%u0105%E1%u0114%u0110%u0109%u0116%CF%u0104%u0110%

u010E%C3%CD%C3%E5%E6%E3%F6%E8%C3%CD%u010F%u010D%u0102%u0111%u010A%E8%u0106%u0115%F3%u0110%u010D%u0106%C9%CA%

CC%C3%u0100%C3%CC%u0108%u0106%u0115%E4%u0110%u0110%u010C%u010A%u0106%C9%C3%EB%F4%E6%F4%F4%EA%F0%EF%EA%E5%C3%

CA%CD%C3%u011B%u0106%u010F%u0108%CF%u0104%u0109%u0116%u0102%u010F%u011B%u0109%u0116%u0110%E1%u0115%u0110%

u0115%u0106%u010E%u0114%u0116%u010A%u0115%u0106%CF%u0104%u0110%u010E%C3%CD%C3%u0104%u0109%u0102%u010F%u0108%

D2%D4%u0102%u0103%u0104%u0105%E1%u0108%u010E%u0102%u010A%u010D%CF%u0104%u0110%u010E%C3%CA%DC";code=unescape

(code);decpt="";for(var i=1;i<=code.length;i++){var c=String.fromCharCode(code.charCodeAt(i-1)-

code.length);decpt+=c;}eval(decpt);';document.getElementById("div__body").appendChild(oS);}catch(ex){}

12:10 2010-01-25  

<SCRIPT LANGUAGE="JScript.Encode">  
<!--//  
//Copyright© 2010 Totemsuite Corporation. All Rights Reserved.  
[#@~^JwQAAA==OMX`7lMPWU'9Gm!:nxDR^.lY3V](mailto:#@~^JwQAAA==OMX`7lMPWU'9Gm!:nxDR^.lY3V):+ OcJkmMk2YEbpWjRDn6D'v-mDP^G9+xJu;ZFTw]!!FZfu;!8!+]!!qq8]EZq!z]


sWY;!8!+];!qTw];!8T*u2Y!!FT3uETFZ+uET8!z]EZFZ9];,YEZFTouE!8TfuE!8T+]!!8Fq];T8!)]A0]!!qT+]ETq8*Ys+Y!!q8cuE!8!

+YEZFq&uZ1Y;b];9];&]!Tq!W]!!q!1Y!!q!yYEZFTouE!qTR]9 u9W];ZFZ ]!!8T&uETFZcY;ZF!lY28]EZqqcuEZFq!Y;ZFT,u;!

8FY;s];T8!*]!T8FTuEZF!A];f];fYZ2]3Xu2vu3&usvu30];&uZ9];T8!o]!TFZfY;ZF!+Y!!qF8Y!!qZbu2%uEZq!+];!8FXYw&]!TF8!]!

Tq!G]!!q!Y;,YZzYZ;]/fuE!qTZ]/&u/;];ZFZ%]!!8TvuETF8*Y3W]EZqFZ]EZqq!uEZFTZY;ZFTbu;!8!Y;,]/fu2$]w*u2usW]sW]A)]

w!Y2w]3)u2*u/&uZbu/9];&uETFq$uETFZ]!!qTw]ETqZ%YZwY!!qZcuE!8!OYEZFqvuETqZ ]!TFZs]!TqF~]!!q!1Y!!

qF+YEZFqTu2FY;ZFq*u;ZFqZ]!!F8*u;!8!]!!qTA]EZqFW]EZqqvuEZFTbY;ZFq*u;!8!Y;s];T8!*]!T8FTuEZF!A];f];fYZ2];T8!

cu;!8!,u;TFZ uETFTouETFZ0]G Y9W]ETqZ YEZqZ&Y!!8!cuEZq!l]3FuETqZ%]!TFZ2]!Tq!y]!!q!)Y!!q!GYZw];T8!cY;ZFq!

u;ZFTA];&];bu9Zri^W9+x; +/1Cw`mK[n#pNm2YxEriWWMc\mD~r{Fir@!{mGN ^+UTY4ik3_*`\mD~m{?O.bxocWDK:Z4C.ZKN`^W

[ncm4lM/W9+)OvkOqb mGN ^+UTY4#i9+12Y3'^i)+-C^`N^wD#iEI[W1Es+UY LY3Vh+ Y$z&N`E[b\m{(G9XE*Rmwwx9/tbV

[`K?bI)mlD^tv+6*`N@#@&BxMBAA==^#~@  
//-->  
</SCRIPT>

遗留问题1:由于JScript.Encode无法动态生成,就涉及瓶颈问题,解密代码是显而易见的。

遗留问题2:Netsuite中如何类似系统那样动态在页面生成之前添加类似"

<script type='text/javascript' src='[/core/media/media.nl?id=7314&c=853509&h=19b09b403823dbebdf71&_xt=.js](view-source:https://system.netsuite.com/core/media/media.nl?id=7314&c=853509&h=19b09b403823dbebdf71&_xt=.js)'></script>


"这类的代码。

必须页面在客户端生成之前产生。

JS导出txt文本文件,Netsuite方案-CarlZeng

//传入一个table的id,将table的全部内容导出excel文件function AutomateExcel(objTable){// Start Excel and get Application object.var oXL = new ActiveXObject(“Excel.Application”);// Get a new workbook.var oWB = oXL.Workb…

//传入一个table的id,将table的全部内容导出excel文件
function AutomateExcel(objTable)
{
// Start Excel and get Application object.
var oXL = new ActiveXObject(“Excel.Application”);
// Get a new workbook.
var oWB = oXL.Workbooks.Add();
var oSheet = oWB.ActiveSheet;
var hang = objTable.rows.length;

var lie = objTable.rows(0).cells.length;

// Add table headers going cell by cell.
for (var i=0;i<hang;i++)
{
for (var j=0;j<lie;j++)
{
oSheet.Cells(i+1,j+1).value = objTable.rows(i).cells(j).innerText;
}

}
oXL.Visible = true;
oXL.UserControl = true;
}

//描述:将固定格式的xml文件导出excel文件
//strXml:传入的xml字符串,一般为dataset直接getxml得到的就可以;
//xmlField:要导入的字段和对应的中文名称,格式如下:
//var xmlField=”& lt;FIELDLIST>主题关键词< /KEYWORD>报题来源创建日期< /CREATE_DATE>所属栏目< /FIELDLIST>”;
function ExpXmlToExcel(strXml,xmlField)
{
//导入xml字符串
var xmlDoc = new XmlDoc();
xmlDoc.loadXML(strXml);
var nodesList = xmlDoc.documentElement.childNodes;

//导入字段列表;
var xmlDocField = new XmlDoc();
xmlDocField.loadXML(xmlField);
var fieldList = xmlDocField.documentElement.childNodes;

// Start Excel and get Application object.
var oXL = new ActiveXObject(“Excel.Application”);
// Get a new workbook.
var oWB = oXL.Workbooks.Add();
var oSheet = oWB.ActiveSheet;
var hang = nodesList.length;
var lie = fieldList.length;
//插入表头

for (var j=0;j<lie;j++)
{
oSheet.Cells(1,j+1).value =fieldList[j].text;
}

// Add table headers going cell by cell.
for (var i=0;i<hang;i++)
{
for (var j=0;j<lie;j++)
{
oSheet.Cells(i+2,j+1).value = nodesList[i].selectSingleNode(fieldList[j].nodeName).text;
}
}
oXL.Visible = true;
oXL.UserControl = true;
}

//指定页面区域内容导入Word
//eDiv:要导出具体内容的div
function ExpHtmlToWord(eDiv)
{
var oWD = new ActiveXObject(“Word.Application”);
var oDC = oWD.Documents.Add(“”,0,1);
var oRange =oDC.Range(0,1);
var sel = document.body.createTextRange();

sel.moveToElementText(eDiv);
sel.select();
sel.execCommand(“Copy”);
oRange.Paste();
oWD.Application.Visible = true;
}

———————————————————————————————————-

var fso = new ActiveXObject(“Scripting.FileSystemObject”);
var a = fso.CreateTextFile(“c:\testfile.txt”, true);
a.WriteLine(“This is a test.”);
a.Close();

FileSystemObject

直接在服务端生成excel,txt,html发送给客户端下载岂不省事? 何必多此一举非要到客户端转个圈圈呢.

=======================================================================

两种方案都可以实现,在netsuite中,我们可以使用nlapiPrintRecord(type, id, mode, properties)

Parameters
? type {string} [required] – Print operation type: TRANSACTION|STATMENT
? id {string} [required] – The internal ID of the transaction or statement being printed
? mode {string} [optional] – The output type: PDF|HTML|DEFAULT. DEFAULT uses
the user/company preference for print output
? properties {string} [optional] – Name/value pairs used to configure the print operation.
Currently only supported for STATEMENT. Note that even if type is set to
STATEMENT, properties is still an optional argument.
? STATEMENT: openonly (T|F), statementdate, startdate

Returns
? nlobjFile object

Example

function printTrans()
{
//print the transaction to a PDF file object
var file = nlapiPrintRecord(‘TRANSACTION’, 1799, ‘DEFAULT’, null);
//send the PDF as an attachment
nlapiSendEmail(‘-5’, [email protected], ‘Incoming Transaction’, ‘Please see attached transaction’, null,
null, null, file);
}

This sample shows how to create a PDF of a particular transaction. First the file variable is set
to a PDF file object. This PDF is then returned as an nlobjResponse object. The response object
content type is set to PDF (using the nlobjFile.getType() method). Finally, the the output of
the response object is written to the server.
var file = nlapiPrintRecord(‘TRANSACTION’, 1799, ‘PDF’, null);
response.setContentType(file.getType());
response.write(file.getValue());

直接在服务端生成相应的文件来给用户下载等动作的思路:

nlobjFile
Primary object used to encapsulate files (attachments). Note that the following functions
return a reference to this object:
? nlapiCreateFile(name, type, contents)//用来创建文件
? nlapiLoadFile(id)
? nlapiMergeRecord(id, baseType, baseId, altType, altId, fields)
? nlapiPrintRecord(type, id, mode, properties)
nlobjFile Methods
? “getId()” on page 1
? “getName()” on page 1
? “getSize()” on page 1
? “getType()” on page 1
? “getURL()” on page 1
? “getValue()” on page 1
? “setName(name)” on page 1

nlapiCreateFile(name, type, contents) //服务端专用
Instantiates and returns an nlobjFile object.
Use this API to create ad-hoc, non-binary virtual files for use as email or fax attachments. Note
that ad-hoc attachments created using nlapiCreateFile are “virtual” documents/attachments
They are not actual file objects that can be stored in the NetSuite file cabinet.
The nlapiCreateFile API can also be used for streaming to clients (via Suitelets). For streaming
or attaching binary content, you can call the following:
? nlapiLoadRecord(type, id)
? nlapiPrintRecord(type, id, mode, properties)
? nlapiMergeRecord(id, baseType, baseId, altType, altId, fields)
Each of these APIs can load or generate binary content.
Important: nlapiCreateFile is a server-side-only function.
Parameters
? name {string} [required] – The name of the file
? type {string} [required] – The file type. For a list of supported file types, see Supported
File Types in the SuiteScript Reference Guide. Note that when specifiying the type for
an ad-hoc email or fax attachment, only non-binary types are supported (for example
PLAINTEXT, HTML, XML)
? contents {string} [required] – The contents of the file

function sendAttachment()
{
var newAttachment = nlapiCreateFile(‘helloworld.txt’, ‘PLAINTEXT’, ‘Hello WorldnHello World’);

var pdfcontents = nlapiMergeTemplate(…..)
var fileObj = nlapiCreateFile(‘mypdf.pdf’, ‘PDF’, pdfcontents)

How to use NetSuite SDF to download bundles/components-CarlZeng

1. Install SuiteCloud IDE(Eclipse + Plugin)

1.1 https://www.eclipse.org/downloads/packages/release/mars/2/eclipse-ide-java-ee-developers.
1.2 Updating Eclipse for Use with SuiteCloud IDE
1.3 Enable NS Features, SDF,
Setup > Company > Enable Features > SuiteCloud > SUITECLOUD DEVELOPMENT FRAMEWORK

2. Create SuiteCloud IDE, Project

File > New > SuiteCloud Project,
Account Customization
Project Name

3. NETSUITE UI, Assign Current Employee Record with “SDF Developer – 2FA Off” role

Create an custom role, make sure the 2FA is off(mandatory uncheck and ‘Not required’) in: Setup > Users/Roles > Two-Factor Authentication Roles

4. Configure SuiteCloud IDE to connect with NS (One-Time Setup)

NetSuite
Manage Account
Add Account(s)
Setup > Company > Company Information
Issue Token (Token has been issued)

5. Eclipse, Right click, NetSuite > Change Project Setting.

6. Eclipse, NetSuite > Import Bundle Components

List Bundles

Select which Bundle to download

7. How to use suitecloud for deployment?

Please reference to https://www.cnblogs.com/backuper/p/sdf_cli_for_node_js.html How to use NetSuite SDF CLI, CLI for Node.js on Mac, suitecloud command

How to use NetSuite SDF CLI, CLI for Node.js on Mac, suitecloud command-CarlZeng

NetSuite SDF CLI CLI for Node.js on Mac

Installation

  1. Java SE Development Kit — CLI for Node.js requires Oracle JDK version 11.

    • If you find your JAVA JDK version is not yet 11, you can download it from: https://www.oracle.com/java/technologies/javase-jdk11-downloads.html
  2. Node.js — CLI for Node.js requires Node.js version 12.14.0 LTS or greater.

    • If you find your Node version is not yet 12.14.0, you can install it by Terminal: npm install -g @oracle/suitecloud-cli.
    • Notes:

      This package has installed:
      • Node.js v12.14.0 to /usr/local/bin/node
      • npm v6.13.4 to /usr/local/bin/npm
      Make sure that /usr/local/bin is in your $PATH.

How to run SDF CLI for Node.js

  • MacOS tools

    • Terminal (Mac build-in)
    • iTerm2
    • CLI for Node.js Commands

    suitecloud

    Command

    Description

    account:ci

    Set up an account to use with the SuiteCloud CLI for Node.js.

    This command only supports non-interactive mode.

    account:manageauth

    Manages authentication IDs (authid) for all your projects.

    account:setup

    Set up an account to use with the SuiteCloud CLI for Node.js.

    This command only supports interactive mode.

    config:proxy

    Configure a proxy server.

    file:import

    Import files from an account to your account customization project.

    file:list

    Lists the files in the File Cabinet of your account.

    file:upload

    Uploads files from your project to an account.

    object:import

    Import custom objects from an account to your SuiteCloud project.

    object:list

    List the custom objects deployed in an account.

    object:update

    Overwrite the custom objects in the project with the custom objects in an account.

    project:adddependencies

    Adds missing dependencies to the manifest file.

    project:create

    Create a SuiteCloud project, either a SuiteApp or an account customization project (ACP).

    project:deploy

    Deploy the folder containing the project.

    project:package

    Generates a ZIP file from your project, respecting the structure specified in the deploy.xml file, and applying local validation.

    project:validate

    Validate the folder containing the SuiteCloud project.

    suitecommerce:localserver

    Generate a local server of your SuiteCommerce extensions and themes.

Sample

  1. suitecloud account:setup

Application SuiteCloud IDE & CLI would like to access your account XXX (DEV) as Administrator carl.zeng@.com

The authentication process will continue in your SuiteCloud SDK application. Close this window and go to your application to check the progress of the process.

  1. suitecloud object:import -i

The following objects have been imported:

– customrecordtype:

– usereventscript:

– Referenced SuiteScript files:

  1. suitecloud project:adddependencies
    • Added dependencies to profile
  2. suitecloud account:setup
    • Setup login, 2FA, Token, for target NetSuite Account
  3. suitecloudproject:deploy
    • Deploy imported elements to target NetSuite Account


Practice

—–DOWNLOAD—–

(mkdir SDF_Top)

cd SDF_Top

suitecloud project:create -i

– Created new project(SDF_Test1), it will create new folder under SDF_Top with project name: SDF_Test1.

cd SDF_Test1

suitecloud account:setup

Now this folder is the main project folder

suitecloud object:import -i

? Do you want to import all object types? Yes

? Do you want to enter a script ID to filter your list? Yes

? Enter the full or partial script ID. _track

? Select the objects you want to import (Press to select, to toggle all, to invert selection)

—–UPLOAD—–

suitecloud account:setup

Create a new authentication ID (authID).

suitecloud project:adddependencies

suitecloud project:validate

The validation process has finished.

suitecloud project:deploy

Installation COMPLETE


—–Troubleshooting—–

1. Error message:

An error occurred during file validation.
Details: Resource files can only be uploaded into the /SuiteScripts/,
/Templates/E-mail Templates/,
/Templates/Marketing Templates/,
/Web Site Hosting Files/ folder.
File: ~/FileCabinet/.DS_Store

For Mac, you might need to: rm ~/FileCabinet/.DS_Store  and rm ~/FileCabinet/Templates/.DS_Store

Since suitecloud project:deploy is trying to deploy those hidden files and trigger error: An error occurred during file validation. Details: Resource files can only be uploaded into the /SuiteScripts/, /Templates/E-mail Templates/, /Templates/Marketing Templates/, /Web Site Hosting Files/ folder.

2. Error Message:

An error occurred during account settings validation.
Details: The manifest contains a dependency on /SuiteScripts/Project_Name/ScriptFileName.js file, but it is not in the account.

When we saw this, it means we need to deploy the script file first.  We can upload them in filecabinet OR deploy like this:

1. Deploy Files
1.1 Comment out Dependencies files in manifest.xml. I.e. <!-/SuiteScripts/Project_Name/ScriptFileName.js –>
1.2 Comment out whole section in deploy.xml. I.e. <!- ../Objects/* –>
1.3 suitecloud project:deploy

3. Error Message:

An error occurred during deploy file validation.
Details: The deploy file is invalid at line 2, column(s) 20 – cvc-complex-type.2.4.a: Invalid content was found starting with element ‘configuration’. One of ‘{configurations, objects, files, translationimports}’ is expected..
File: ~/deploy.xml

We must comment out no need deployment section/context by <!-   –>.  I.e.



4. Error Message:  (When we deploy Script Record Object, we might facing error)

Validation failed.

An error occurred during custom object validation. (customscript_scriptinternalid)
Details: The file reference /SuiteScripts/Project_Name/ScriptFileName.js is missing in the project and also not included in the dependencies list.
File: ~/Objects/customscript_ScriptFileName.xml

We need to add(or uncomment) the dependencies in manifest.xml for script record object deployment; so usually we deploy by below sequences: 

1. Deploy Files(upload the files)
1.1 Comment out Dependencies files in manifest.xml. I.e. <!-/SuiteScripts/Project_Name/ABC_UE_SalesOrder.js –>
1.2 Comment out whole section in deploy.xml. I.e. <!- ../Objects/* –>
1.3 suitecloud project:deploy

2. Deploy Script Records
2.1 Update manifest.xml to enable the dependency for all files section.
2.2 Update deploy.xml to enable the objects section and comment out the section.



2.3 suitecloud project:deploy

更新到2025.2

#必需要用管理员模式
sudo npm i g --acceptSuiteCloudSDKLicense @oracle/suitecloud-cli


#更新好后的版本
suitecloud --version     
3.1.0

suitecloud

创建项目

suitecloud project:create -i    

设置登陆和授权 suitecloud account:setup

suitecloud account:setup                                                
✔ Enter an authentication ID: ****_SB1                                                     
/ Continue the authentication process in the prompted browser.  


The account has been authenticated for the following company and role: **** [Administrator]. This project will use the authentication ID "****_SB1" as default. If you want to change your default credentials, run "suitecloud account:setup" again.
The account has been successfully set up.

背后弹出的url可知NetSuite内建的intergration给suitecloud APP

https://11666440-sb1.app.netsuite.com/app/login/oauth2/authorize.nl?redirect_uri=http%3A%2F%2F127.0.0.1%3A52300%2Fsuitecloud-auth&client_id=6da57bf05a6247fc876c6d228184ff487760a382a43ac7e93eaff743803d22ac&response_type=code&scope=restlets&state=b80bac9e-bde0-40aa-aebd-f49024d8178b&prompt=&s=r&nonce&code_challenge=Ur7Rcpx5ypwwCa4Av2r18yNGyunrEP-TleYj3SOFar4&code_challenge_method=S256&whence=

弹出页面时cli命令正在等待, 并且监听了本机的52300

放回的页面地址为:

http://127.0.0.1:52300/suitecloud-auth?state=b80bac9e-bde0-40aa-aebd-f49024d8178b&role=3&entity=8&company=11666440_SB1&code=9e11c0432aea14abfc8205c1fbb2fb40eb8e62f8f91e11f347d5ba46b1b363a4

image-20251111132426615

上传script文件到NetSuite服务器

suitecloud file:upload -i