云端随笔 Carl Notes

ERP IT方案 电玩

我们知道 netsuite的url构造https://system.netsuite.com/app/accounting/transactions/opprtnty.nl?whence=都是有规律的! 这些nl 您传递什么参数给他, 它肯定就要要什么规律来执行了今天发现了一个新的内置参数:selectedtab例如:selectedtab=accessselectedtab=history在ur...
阅读全文 »

Quick TECHNICAL Note

Reality: UPS only support WebServices integration(or window platform exe application: FedEx Ship Manager® Lite), friendly for JAVA, PHP or C#.

We need to calling UPS SOAP services in NetSuite directly, so there is JSON -> XML for input expected XML parameters and parse API return result XML -> JSON action. 

Different from UPS, There is high request for xml’s element order/sequence for FedEx API.

This’s a re-usable framework for intergration with WebServices platform/application.

Registration for the Developer Keys

We will need registration on webside got

Developer Test Key: PFPtfQE9ME1N****
Required for FedEx Web Services for Intra Country Shipping in US and Global

and the Email Box:

Title: Your Developer Test Key Registration is complete

Test Account Information
<spacer.gif>
Test URL: https://wsbeta.fedex.com:443/web-services
Test Password: H6F4kyFrYIQxALXOTbH53****

FedEx Web Services Testing Information:
FedEx Shipping Account Number: **0088000
FedEx Meter Number: ***2012**

On NetSuite Side we are targeting to achieve xml files like the sample:

Example 1:Rate Request

<SOAP-ENV:Envelope xmlns:SOAP-ENV=”http://schemas.xmlsoap.org/soap/envelope/“ xmlns:SOAP-
ENC=”http://schemas.xmlsoap.org/soap/encoding/“ xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance“ xmlns:xsd=”http://www.w3.org/2001/XMLSchema“ xmlns=”http://fedex.com/ws/rate/v28">
SOAP-ENV:Body



XXXXXX
XXXXXX


XXXXXX
XXXXXX



XXXXXX
XXXXXX


RateRequest_v28


crs
28
0
0


2020-02-25T12:34:56-06:00
REGULAR_PICKUP
PRIORITY_OVERNIGHT
FEDEX_BOX

LB 20.0 XXXXXX FedEx-WAPI XXXXXX
SN2000 Test Meter 8 10 Fedex Parkway AUSTIN TX XXXXXX US
XXXXXX Recipient Contact XXXXXX
Recipient Address Line 1 Recipient Address Line 2 Collierville TN XXXXXX US
SENDER XXXXXX BUSINESS\_STATE 123456 LIST 1 1 1 1 LB 20.0 12 12 12 IN XXXXXX XXXXXX 12 ContentDescription

And all above xml element is dynamically transfered from NetSuite Sales Order data(and also data from location, currency, custom record types, settings), We got those data(in expected order), using the Google Project’s X2JS to convert from JSON to XML.

Next resolve the across domain ajax call by using NetSuite 2.0 API https.post

var response = https.post({
url: ‘https://wsbeta.fedex.com:443/web-services‘,
body: new X2JS().json2xml_str(PostDataObj),
headers: {
“Accept”: “image/gif, image/jpeg, image/pjpeg, text/plain, text/html, */*“,
“Content-Type”: “text/xml”,
“Access-Control-Allow-Origin”: ‘*‘,
}
});

Need to thanks this thread for useful notes: https://stackoverflow.com/questions/62523251/creating-a-http-post-call-for-fedex-web-services  

FedEx Webservices Errors

  • Response Code 400 or 500

    • Accross domain Error
    • Schema Error

     

  • UnrecoverableClientError
    SchemaError
    validation failure for RateRequest Error:cvc-complex-type.2.4.a: Invalid content was found starting with element

    • Check the XML object sent to FedEx, the order of the element MUST match to the WDSL schema
    • Check the XML object elements if there is addtional property
  • FedEx 404 Unrecoverable ClientError

Share tools used between XML and JSON

Estimate Rate

Integrate with existing UPS integration

While end-use switching shipping carries, we need to clean up the backend package list data and rebuild for current shipping carrier, since UPS and FedEx are using DIFFERENT formating and propertys.


NetSuite’s javascript engine is Rhino(I.e. Rhino 1.7), we can not run node-based code on NetSuite, however,

write your code as, say, an npm module, and run npm scripts from the command line. I have done this in the past for unit testing, doc generation, eslint, etc. In order to actually run code in NetSuite, though, it must be in a plain .js file that NetSuite can interpret and load as a Library on your Script record.

Node.js in SuiteCommerce

downloading Node.js to use for SuiteCommerce.

How can I use Node.js in Netsuite?

20231008 Server端没有开启解释器,没配置环境,就无法识别原生的Node.js代码


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


//传入一个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...
阅读全文 »

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 “ },
{ “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 “ },
{ “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 “ },
{ “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 ERROR: Invalid department reference key 24 处理办法: 分析原因,1,这个24的internalid for Field department 是肯定有的,而系统却给出了出错提示, 说明系统在做类似下拉菜单选中department为24的部门的时候 出现了无法选择的项 , 所以系统认为这个下拉框中没有内容, so error popup....
阅读全文 »

0%