Skip to content

erjobi/SuiteSnippets

Repository files navigation

SuiteSnippets

This is an extention that contains snippets useful for writing SuiteScript 2.0 (or 2.X) for NetSuite.

  • All Information within these snippets was scraped from NetSuites Help Documents.

    Snippet Format

    • Prefix: SuiteScript method or property
    • Description: Information from the first table displayed in NetSuites help document for that particular method or property. (Description, Returns, Supported Script Types, Governance, etc.)
    • Body:
      • Methods: Display the piece of code needed to call them and provide tab stops to update options quickly
      • Properties: Generally provide a link to the NetSuite Help Documents

    Snippets

    You can type things like "record." and you will see options for "record.load", "record.copy", "record.attach", etc.

    SuiteSnippets

    Snippet Example

    record.load(options)

    record.load({
        type: string*,
        id: number*,
        isDynamic: boolean true | false,
        defaultValues: Object
    })

    Notes:

    • First tab stop allows you to rename "record" to "r" or anything else you imported the module as
    • After that, each value is a tab stop
    • Default value of each key-value pair is the expected type
    • Values ending with * indicate mandatory values

    Example Codes

    Also provided are code samples from the NetSuite Help Documentation.
    Simply add "x." to the begining of your results and you will see any code samples NetSuite has provided.

    Example Codes Example

    x.record.load

    // Code Example 1
    // Add additional code.
    //...
    
    // Load a sales order.
    
    var objRecord = record.load({
        type: record.Type.SALES_ORDER, 
        id: 157,
        isDynamic: true,
    });
    
    // Load an instance of a custom record type with the ID customrecord_feature.
    
       var newFeatureRecord = record.load({
        type: 'customrecord_feature',
           id: 1,
           isDynamic: true                       
       });
    ...   
    // Add additional code. 
    

    Enumerations

    Also provided are enumerations from NetSuite Help Documents.
    When typing in the prefix of the enumeration, select the Enum snippet to populate a list of available enumerations.

    Enumeration Example

    record.Type enums

    CHANGE LOG

    2020.2.0 - November 20 2020

    1. Changed Extension Versioning to mimic NetSuite releases
      • I intend to release a new update after each NetSuite release
    2. NetSuites 2020.2 Update included many updates to SuiteScript API
    3. Added module names to snippet names to allow multiple snippets with the same name to function properly
      • Example: Field.Id is part of N/record, N/currentRecord, and N/ui/serverWidget
      • Previously, Field.Id for N/ui/serverWidget would overwrite the snippets for N/record and N/currentRecord
      • Now, all three are available
    4. Examples now include a link to help docs
    5. Links to help docs now redirect correctly (using system.netsuite.com)
    6. serverWidget.fieldType ENUM was actually fixed this time
    7. Added link to buy me a coffee in SUPPORT section below :]

    2.0.0 - August 10 2020
    • NS 2020.1 Update included changes to SuiteScript - these have all been captured in this release
      • Please see "NetSuite 2020.1 Release Notes"
    • serverWidget.fieldType ENUM was missing some values - added missing values
    • record.submitFields was missing a closing brace - updated

    1.0.2 - May 27 2020
    • Some enumerations were missing their choices - updated missing ones
    • Some methods were showing a blank choice tab stop after them - found and removed the tab stop
    • Updated Icon


    1.0.1 - May 26 2020
    • Example codes from help documents often include a line of "..." when NetSuite is indicating that there is code before/after the example. Updated these lines to "//..." so they are commented out by default.

    ABOUT ME

    Hi, my name is Eric Birdsall
    I'm a self taught programmer originally from upstate New York
    I believe in making tools that can be used to make tools
    I hope you find this to be one of those tools http://ericbirdsall.dev
    Please excuse my website, it is bad.


    SUPPORT

    A lot of time goes into maintaining this extension.
    It would mean the world to me if you bought me a coffee.

  • About

    VS Code Extension - SuiteSnippets

    Resources

    Stars

    Watchers

    Forks

    Releases

    No releases published

    Packages

    No packages published