Skip to content

Latest commit

 

History

History
408 lines (342 loc) · 9.5 KB

SUITELETS.md

File metadata and controls

408 lines (342 loc) · 9.5 KB

SUITELETS

Suitelets are extensions of the SuiteScript API that allow you to build custom NetSuite pages and backend logic. Suitelets are server scripts that operate in a request-response model, and are invoked by HTTP GET or POST requests to system generated URLs. NetSuite Serverside Scripts.

CLEAR BIN AVAILABLE INVENTORY

clear_bin_available_inventory.ts

Setup

This script will display all items currently in the given bin. It will then create an inventory adjustment and "zero" them out.

Script Deployment

Script requires a parameter.

ID Type Description
_bin_available_items_search_id Free-Form-Text The saved search to use

Saved Search

Create a saved (item) search and make sure you make it public. Use the following.

Standard
Filter Description Formula
Bin On Hand: On Hand is not 0
Results
Field Formula Custom Label
Name
Item SKU (Custom)
Bin On Hand: Available
Bin On Hand: Location
Bin On Hand: On Hand
Bin On Hand: Bin Number
Formula(Text) {binonhand.binnumber.id} Bin Id

DISCONTINUE ITEMS

discontinue_items.ts

Setup

This script will search for items based on a partial SKU. It will then create an inventory adjustment and "zero" out all available inventory for the given SKUs. Lastly it will mark the items inactive.

The search depends on a custom item field (custitem_sp_item_sku). This is because the item name / number field (itemid) for a matrix item during a search will show up as parent item name / number : child item name / number for example: og-black-tee : S001BS.

Set this field to default to the following formula.

CASE WHEN INSTR({itemid},' : ') != 0 THEN SUBSTR({itemid}, INSTR({itemid},' : ') + 3) ELSE {itemid} END

Searches for all SKU(s) that match the provided partial SKU. It then creates a "zero" inventory adjustment and sets the item to inactive.

GET RETAIL REPLENISHMENT ITEMS

get_retail_replenishment_items.ts

Setup

This script will create a Transfer Order based on min and max stock for the Retail Store Location.

Script Deployment

Script requires 2 paramaters.

ID Type Description
custscript_retail_replenishment_search Free-Form-Text The saved search to use
custscript_retail_replenishment_dir Free-Form-Text The directory to save the CSV file to

Saved Search

Create a saved (item) search and make sure you make it public. Use the following.

Standard
Filter Description Formula
Inventory Location is Retail Store
Formula (Numeric) is 1 CASE WHEN NVL({custrecord_rfs_replenishment_rule_item.custrecord_rfs_replenishment_rule_bin}, ' ') = 'Receiving - Store' THEN 1 ELSE 0 END
Formula (Numeric) is 1 CASE WHEN {quantityavailable} > 0 AND NVL({locationquantityonhand},0) < NVL({custrecord_rfs_replenishment_rule_item.custrecord_rfs_replenishment_rule_max},0) / 2 THEN 1 ELSE 0 END
Shopify Retail (Custom) is true
Formula (Numeric) is not 0 CASE WHEN (NVL({quantityavailable},0) - NVL({locationquantityavailable},0)) > 0 AND (NVL({quantityavailable},0) - NVL({locationquantityavailable},0)) >= NVL({custrecord_rfs_replenishment_rule_item.custrecord_rfs_replenishment_rule_max},0) - NVL({locationquantityavailable},0) THEN NVL({custrecord_rfs_replenishment_rule_item.custrecord_rfs_replenishment_rule_max},0) - NVL({locationquantityavailable},0) ELSE (NVL({quantityavailable},0) - NVL({locationquantityavailable},0)) END
Results
Field Formula Custom Label
Formula (Date) {today} Date
Formula (Text) CONCAT(CONCAT({inventorylocation},'-'),{today}) Transfer Name
Inventory Location
Formula (Numeric) NVL({locationquantityavailable},0) Store Qty Available
Formula (Text) {custrecord_rfs_replenishment_rule_item.custrecord_rfs_replenishment_rule_bin} Bin Name
Formula (Numeric) {custrecord_rfs_replenishment_rule_item.custrecord_rfs_replenishment_rule_max} Store Qty Max
Name SKU
Display Name
Type
Formula (Numeric) NVL({quantityavailable},0) - NVL({locationquantityavailable},0) Total Available (All Locations)
Formula (Numeric) CASE WHEN (NVL({quantityavailable},0) - NVL({locationquantityavailable},0)) > 0 AND (NVL({quantityavailable},0) - NVL({locationquantityavailable},0)) >= NVL({custrecord_rfs_replenishment_rule_item.custrecord_rfs_replenishment_rule_max},0) - NVL({locationquantityavailable},0) THEN NVL({custrecord_rfs_replenishment_rule_item.custrecord_rfs_replenishment_rule_max},0) - NVL({locationquantityavailable},0) ELSE (NVL({quantityavailable},0) - NVL({locationquantityavailable},0)) END Quantity to Transfer
Is Available?

Create Saved Import

Use the following settings.

Setting Value
Import Type Transactions
Record Type Transfer Order
Character Encoding Unicode (UTF-8)
CSV Column Delimeter Comma

Use the following mappings.

CSV Field or Default Value NetSuite Field
transferName Transfer Order : ExternalId
Dap Transfer Order : Incoterm (Req)
Main Warehouse Transfer Order : From Location
transferName Transfer Order : Memo
Pending Fulfillment Transfer Order : Status (Req)
Suavecito, Inc. Transfer Order : Subsidiary (Req)
date Transfer Order : Date (Req)
Retail Store Transfer Order : To Location (Req)
id * Set ref to Internal ID Transfer Order Items : Item
quantityNeeded Transfer Order Items : Quantity

Run the Suitelet

You can find the internal link via the script deployment attached to the script record

A CSV file containing all transfer order import data will be generated and saved to the File Cabinet under the Retail Store Replenishments directory.

POST ITEM TO SHOPIFY

post_item_to_shopify.ts

Setup

This script will post to a custom API and create an item / product in Shopify.

Script Deployment

Script requires 2 paramaters.

ID Type Description
custscript_servername Free-Form-Text API server url
custscript_netsuite_to_shopify_secret Free-Form-Text Secret used for HMAC

Depends on Forge for HMAC creation.

Re-Print Invoices

reprint_invoices.ts

Setup

The script will search for all invoices for the given customer. It will then let the user select what invoices they want to merge and download as one pdf.

Set FarApp / NetSuite Connector - Shopify Sync

set_farapp_shopify_sync.ts

Setup

The script will search for items based on a partial SKU. It will display all mandatory fields for posting to Shopify. It will also update the FarApp Shopify Flag fields.

Script Deployment

Script requires 1 parameter.

ID Type Description
custscript_sp_set_farapp_shpfy_sync_ur Free-Form-Text The Deployment URL

VENDOR BILLS

vendor_bills.ts

Setup

This script will generate a list of all open vendor bills and let the user select which vendor bill(s) they want to pay and create checks for.