@hitc/ssv2-utilities

2021.1.0 • Public • Published

Head in the Cloud - SSv2 Utilities

A collection of utility functions while using SSv2.

Usage instructions

Before you begin, install the bundle 121445 into the target NetSuite account. This will make the libraries available for use in that account.

To install the TypeScript typings definitions into your project, first make sure you have SuiteScript 2.0 typings installed by following the instructions here.

Then you install these typings definitions with the following command:

npm install --save @hitc/ssv2-utilities

Importing utilities into your project

First, make sure you're referencing the correct typings file:

/// <reference path="<projectroot>/node_modules/@hitc/ssv2-utilities/ssv2-utilities.d.ts" />

Then, import one of the functions into your script using the following code snippet as an example:

import getAllResults from '/.bundle/121445/HITCSSV2Utilities/ssv2/getAllResults';

You can now use the getAllResults function with all its type-cast glory in your project. Now when this runs in the NetSuite environment it will import from the installed bundle.

Map/Reduce Debugger

  • Create or modify an existing deployment under the "Map/Reduce Debugger - Scheduled" script
  • Under the parameters tab, specify the File Cabinet path that leads to the Map/Reduce script file you're wanting to debug
  • Debug the deployment and step into the functions you're wanting to debug

Utilities

getAllResults

getAllResults is a function that takes a NetSuite Search object as an input and returns the entire set of SearchResults that can be returned from said search object.

function getAllResults(searchObj: Search) : SearchResult[]

CachedSearch

CachedSearch is a class that can be instantiated with a NetSuite Search object. You may then continue to call CachedSearch.getResult(row:number) and it will intelligently load the appropriate page of data (or access a pre-loaded page if it's available) and return at the index you've specified.

class CachedSearch {
    public pageSize : number = 200;
    public search : Search = null;
    public constructor(search:Search);
    public getTotalResultCount() : Promise<number>;
    public getResult(row:number) : Promise<SearchResult>;
}

MVC

To be documented

Readme

Keywords

none

Package Sidebar

Install

npm i @hitc/ssv2-utilities

Weekly Downloads

12

Version

2021.1.0

License

Copyright 2018 Head in the Cloud Development Inc.

Unpacked Size

230 kB

Total Files

86

Last publish

Collaborators

  • hitc