iT邦幫忙

2021 iThome 鐵人賽

DAY 9
1
自我挑戰組

NetSuite Foundation & Customization系列 第 9

CSV Import - Advanced

CSV Import - Advanced

昨天介紹了如何使用 CSV Import update Sales Order 內欄位後, 今天我們要來介紹如何用 CSV Import 建立一張 Sales Order.

在一開始的文章有提到, 建立一個 Sales Order 有幾個必要的條件

  • Validate Customer
  • Date
  • At least 1 item

Custoemr 的部分我們沿用之前建立的測試客戶, id: 2538
Date 就用今天的日期 23/09/2021
Item 除了使用之前建立的測試商品外, 增加另外一個測試item(ACC00002), id: 1175, 501
https://ithelp.ithome.com.tw/upload/images/20210923/20141364HXTMvqtRou.png

建立 CSV File

利用文字編輯軟體或是 Excel 將剛剛的資訊填入

https://ithelp.ithome.com.tw/upload/images/20210923/20141364CHikPr6Ddg.png

可以看到多了一個 external Id 的欄位, 這個欄位主要是告訴 NetSuite, 相同 External Id 的 row 都視為同一筆Sales Order. 而 NetSuite 會將同樣 external Id 的第一筆row 當做主檔(Main Line)內容, 後面的 row 都會當作是item sublist的內容.

所以對於test_order_1而言, row#2 是主檔內容, row#3 and row#4 是 item 資訊

Generate CSV Import

按照昨天的教學, 開啟 CSV Import Assistant.

https://ithelp.ithome.com.tw/upload/images/20210923/201413642MTC9IGJ1N.png

填入以下內容後按 next

  • Import Type: Transactions
  • Record Type: Sales Order
  • Select CSV File
    https://ithelp.ithome.com.tw/upload/images/20210923/20141364NSRe7cdCZS.png

Import Option 選擇 ADD, Next

https://ithelp.ithome.com.tw/upload/images/20210923/20141364Z2z9sqbi2W.png

接下來到 Field mapping 的部分, 應該可以看到類似的截圖
https://ithelp.ithome.com.tw/upload/images/20210923/201413649Cp70aHAyk.png

這邊我們需要注意一件事情, NetSuite 預設是透過 Name 的方式進行對應, 但我們的 CSV 內填入的都是 id, 所以我們需要在 Field Mapping 這邊更改.

首先更改 Entity 的部分, 點一下 Entity 旁邊的小按鈕
https://ithelp.ithome.com.tw/upload/images/20210923/201413647i0bgubcbC.png

Choose Reference Type 的地方, 選擇 Internal Id, click Done.
https://ithelp.ithome.com.tw/upload/images/20210923/20141364ChstFEP28O.png

相同的也把 Item 從 Names 改成 Internal id.

完成後 Click Next, 並選擇 "Saved & Run"

在 Status 頁面確認跑完沒有錯誤之後, 可以 Transactions -> Sales -> Enter Sales Orders -> List
https://ithelp.ithome.com.tw/upload/images/20210923/20141364YrJXalIW11.png

可以看到第一筆, 就是我們 透過 CSV Import 產生的 Sales order
https://ithelp.ithome.com.tw/upload/images/20210923/20141364DmIWYCcv7G.png

查看 Sales Order 內容, 也確認出現兩筆 item, 數量分別為 2 跟 3
https://ithelp.ithome.com.tw/upload/images/20210923/20141364V3zWXzt3AE.png

這樣就表示 CSV Import 成功.

小記

除了簡單的 CSV Import update/create 之外, csv import 還可以做很多操作, 比方說更新一些在UI上不允許更新的 value, 有時候也能透過 CSV Import 來更改.

在處理大量資料的時候, 用 CSV Import 的 速度會遠比透過 script 來得更快更有效率.


上一篇
CSV Import
下一篇
Basic NetSuite Customization Glossary
系列文
NetSuite Foundation & Customization16
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言