NetSuite SuiteCloud Samples

repository·main·Indexed 41 days ago

https://github.com/oracle-samples/netsuite-suitecloud-samples

Sample projects for account customization on the NetSuite SuiteCloud platform using the SuiteCloud Development Framework (SDF). Includes implementations for the NetSuite AI Connector Service using Model Context Protocol (MCP) for custom tool scripts and toolsets (compatible with NetSuite 2026.1), as well as Single Page Application (SPA) SuiteApp samples using the NetSuite User Interface Framework (UIF) and TypeScript.

Tokens
69.5K
Snippets
125
Records
270
Agent score
51%

What's inside NetSuite SuiteCloud Samples

  1. Overview of the SuiteScript Optimization Sample

    main

    This project demonstrates a caching mechanism for retrieving and storing state-specific shipping rates in NetSuite Sales Orders to optimize performance. It uses a combination of a User Event script to fetch data from an external API and a Suitelet to provide a management UI.

    Key components:

    • sl_cacheManager.js: A Suitelet that displays current cached shipping rates and provides a button to purge the cache.
    • ue_shippingRates.js: A User Event script that fetches state-specific shipping rates from an external API and updates the cache during Sales Order operations.
  2. Overview of the MR Execute Macro Map/Reduce Script

    main
    This project demonstrates how to trigger a macro against sales orders identified in a NetSuite transaction workbook. The solution uses a Map/Reduce script to retrieve workbook data via the N/query module, execute a macro against specific sales orders (filtered by status, mainline, tax line, shipping line, Custom GL, and custom numeric formulas), and save the records. The script also logs usage, elapsed time, and errors.
  3. Overview of Sales Order Deposit Tracking Customization

    main

    This customization project uses four User Event scripts to track the total amount of deposits and refunds on Sales Orders. It is designed to help track layaways or manage customer deposits, refunds on deposits, and gift certificates applied to a sales order balance before invoicing.

    Key components include:

    • Custom Fields: Amount Deposited (stores total deposits) and Balance Remaining (stores the remaining balance).
    • Saved Search: Deposit Balance on Sales Order used to determine the balance of customer deposits.
    • Scripts: Four User Event scripts triggered on beforeSubmit and afterSubmit entry points.
  4. Overview of Custom Tool Samples for NetSuite AI Connector Service

    main

    This repository contains sample SuiteCloud projects designed for the NetSuite AI Connector Service. The service uses the Model Context Protocol (MCP) to enable secure integration between NetSuite and external AI solutions.

    Key capabilities demonstrated in these samples include:

    • Automating NetSuite tasks via AI.
    • Extending NetSuite capabilities through custom tools.
    • Integrating with external AI clients for data retrieval and process automation.

    Implementation details:

    • Tools are built using custom tool scripts and SuiteScript 2.1.
    • Projects are managed within a SuiteCloud Development Framework (SDF) Account Customization Project (ACP).
    • Tools utilize standard SuiteScript modules.
  5. Overview of the MR Transform Record Map/Reduce Script

    main

    This project demonstrates a NetSuite customization that automates the creation of Item Fulfillment and Invoice records based on data from a Transaction Workbook.

    Workflow:

    1. The script uses the N/query module to retrieve sales orders from a workbook that were created on the current day with the mainline set to true.
    2. It examines the transaction status of each order.
    3. If the status is NOT 'pending billing': The script creates an Item Fulfillment record and populates required fields.
    4. If the status IS 'pending billing': The script creates an Invoice record.
    5. The script logs usage, elapsed time, and errors using the N/log module.
  6. Overview of the Fulfill Back Orders sample

    main

    This SuiteScript sample automates the synchronization of item quantities between Sales Orders and their associated Item Fulfillment records. It specifically targets partially fulfilled sales orders to ensure back-ordered items are accounted for in the fulfillment records.

    Workflow:

    1. Identify: Finds Sales Orders with a status of Pending Billing/Partially Fulfilled that have back-ordered item quantities greater than zero.
    2. Calculate: Retrieves the associated Item Fulfillment record.
    3. Update: Adds the back-ordered quantity from the Sales Order to the existing quantity on the Item Fulfillment record.
    4. Result: The Sales Order status moves to Pending Billing once quantities are synchronized.
  7. Overview of the LLM Chatbot Suitelet Sample

    main

    This project demonstrates how to build a chatbot interface directly within NetSuite using a Suitelet. It leverages the N/llm module to interact with a Large Language Model (via OCI Generative AI) and the N/ui/serverWidget module to render a custom NetSuite form.

    Key functionality includes:

    • Creating a NetSuite form to capture user input.
    • Sending requests to an LLM and receiving responses.
    • Displaying chat history and responses using serverWidget fields.
    • Using a submit button to trigger the request-response cycle.
  8. Understand the Automatic Purchasing Example

    main

    This example demonstrates how to implement an automated purchasing process in NetSuite using a combination of Custom Records, Custom Fields, and a Map/Reduce script.

    Core Logic:

    • Trigger: Automatic purchase occurs when an Inventory Item's stock count falls below a configured limit.
    • Constraint: Automatic purchases are skipped if the Item already has pending Purchase Orders.
    • Configuration: Users must manually create Auto-Purchase Setup instances to define the relationship between an Item and a Vendor.
    • Key Concept: It utilizes the "Is Parent" property of Custom Record fields to allow the Auto-Purchase Setup record to appear as a sublist directly on standard Vendor and Inventory Item records.
  9. Use N/query and SuiteQL for high-performance data processing

    main

    This project demonstrates how to use the N/query module and SuiteQL to process large datasets in NetSuite. Using N/query with SuiteQL provides better performance than the traditional N/search module and supports complex, multi-level joins across multiple record types.

    Key files in this sample include:

    • Simple Query + RunSuiteQL.js: Demonstrates retrieving transaction fields (id, date, entity, total) using the N/query API and running SuiteQL with mapped results.
    • Load a workbook then convert to SuiteQL.js: Shows how to load a custom workbook from the SuiteAnalytics Workbook interface and convert its query into SuiteQL.
    • MapReduce Script.js: A Map/Reduce implementation that uses a query to retrieve employee company performance data and sends the results via email in the summarize stage.
  10. Automate customer email communication using SuiteTalk REST APIs

    main

    This sample project demonstrates how to automate email communication to customers using NetSuite's SuiteTalk REST Web Services.

    Workflow:

    1. Use a SuiteQL query to search for existing communication associated with a specific customer.
    2. If no existing communication is found, the system creates and sends a message to the appropriate entities.
    3. Once the communication is sent, the record is marked as processed to prevent duplication.

    Required Customizations: To use this sample, your NetSuite environment must include:

    • A custom list field for company size: custentity_company_size.
    • A custom dataset configured to list all messages.