SlideShare a Scribd company logo
SuiteScript 2.0 API
Netsuite
Released 2015 ∼
July 13, 2018
Agenda
NetSuite at a glance
What is SuiteScript API?
Key concepts of SuiteScript 2.0 API
SuiteScript 2.0 Syntax
HelloWorld Script
Advantages of SuiteScript 2.0
Drawback
Coexistence rules
1
Objectives of this presentation
Understanding the basics of SuiteScript 2.0 API
Explore the key differences between SuiteScript 1.0 & SuiteScript 2.0
2
NetSuite at a glance
Cloud-based business management software
Software as a Service (SaaS)
3
Is a JavaScript API that offers a broad range of options
for enhancing and extending NetSuite
SuiteScript API
What is SuiteScript API?
😟 😎 4
Key Concepts
of
SuiteScript 2.0
5
SuiteScript 2.0 is modular
All SuiteScript 2.0 APIs are organized into modules
Each module reflects the functionality
Concept #1:
6
NetSuite modules & objects
record searchlog file
NS
N
create({}) save({})load({})
∼32 modules
e.g: N/file
∼… APIs
e.g: record.create({});
setValue({}) …({})
Concept #1 (cont’d)
7
Module must be explicitly loaded by a script before using that module’s API
Suitescript 1.0 API
Organized in a Single global library JavaScript file.
Each file gets loaded to every single script regardless of how much API the script use.
Suitescript 2.0 API
Organized and grouped into the modules
Modules are loaded only when they are needed. — based on Asynchronous
Module Definition(AMD)
Now
Before
Modular
Concept #1 (cont’d)
8
Object as Arguments
The arguments passed to methods are typically {key:value} objects
var myObject = {
fieldId: 'greetingMsg',
value: 'Hello, World!'
};
myRecord.setValue(myObject);
myRecord.setValue({
fieldId: 'greetingMsg',
value: ‘Hello, World!'
});
Concept #2:
9
Suitescript 1.0 API
Argument list
Suitescript 2.0 API
Object as argument
Now
Before
‣ Objects
var myObject = {
fieldId: 'greetingMsg',
value: 'Hello, World!'
};
myRecord.setValue(myObject);
nlapiSetFieldValue('greetingMsg', 'Hello, World!');
Concept #2 (cont’d)
10
Script types and their Entry pointsConcept #3:
Script type:
SuiteScript 2.0 scripts consist of several script types
Each script type is designed for a specific type of situation and specific
types of triggering events
Entry point:
Represents the juncture at which the system grants control of the NetSuite application to
the script.
Each script type includes one or more entry points that are exclusive to that type
11
UserEventScript
ClientScript
ScheduledScript
…
Server
(execute on the server)
Client
(execute in the user’s
browser)
Script types Entry points
✦ beforeLoad
✦ beforeSubmit
✦ afterSubmit
✦ execute
✦ fieldChange
✦ pageInit
✦ Etc…
Concept #3 (cont’d)
12
…
Suitescript 1.0 API
Scripts are not Expressive: - hard to recognize the purpose of a script
Scripts are Dependent: - Actions depend on settings done on NetSuite side
Suitescript 2.0 API
Expressive scripts - automatically detected by NetSuite
Independent scripts - No other enhancements needed.
Now
Before
‣ JSDocs tags
‣ Script types & Entry points
function myFunction(){
// logic here
}
sample_script.js
/**
* @NScriptType <script_type_name>
*/
define([], function() {
function myFunction(){
// logic here
}
return {

<entry_point_name> : <entry_point_function>

};
});
sample_script.js
Concept #3 (cont’d)
13
Entry point scripts & Custom module scriptsKey concept #4:
Entry point script:
The primary script attached on the script record
It identifies the script type, entry points, and entry point functions
Each entry point script must include at least one entry point and entry point function
Custom module script:
Is a user-defined script that holds the logic that can be used by other scripts
It’s loaded by an Entry point script as a dependency
Script type(s) declaration is not required
14
Suitescript 1.0 API
Suitescript 2.0 APINow
Before
NS
Script record A Script record B
script_A.js script_B.jsscript_A.js script_B.js
NS
Script record A Script record B
script_A.js script_B.js
‣ Custom module scripts
Concept #4 (cont’d)
15
Same modules used by-
many script records
Anatomy of an Entry Point Script
/**
* @NApiVersion 2.0
* @NScriptType UserEventScript
*/
define(['N/record', 'N/ui/dialog'],
function(record, dialog) {
function doBeforeLoad() {
/* logic of function*/
}
function doBeforeSubmit() {
/* logic of function*/
}
function doAfterSubmit() {
/* logic of function*/
}
return {
beforeLoad : doBeforeLoad,
beforeSubmit: doBeforeSubmit,
afterSubmit : doAfterSubmit,
};
}
);
JSDoc tags:
Required for an entry point script
Entry points:
At least one STANDARD entry point is required for
a script type
Define’s first argument:
List of Dependencies and/or Modules
3
2
1
4
Define’s second argument:
Callback function
1.
2.
3.
4.
Concept #4 (cont’d)
16
Anatomy of a Custom Module Script
JSDoc tags:
NOT Required for a custom module script, but USEFUL.
Entry point:
At least one USER-DEFINED entry point is required for a
custom module
Define’s first argument:
List of Dependencies and/or Modules required by the script
/**
* fileName.js
* @NApiVersion 2.x
* @ModuleScope Public
*/
define(['N/record', ’N/search'],
function(record, search) {
function dummySearch() {
/* logic of function*/
}
return {
myDummySearch : dummySearch,
};
}
);
3
2
1
4
Define’s second argument:
Callback function
1.
2.
3.
4.
Concept #4 (cont’d)
17
Syntax
18
SuiteScript 2.0 Syntax
SuiteScript 2.0 syntax == JavaScript Syntax
๏ SuiteScript 2.0 methods takes plain JavaScript key/value object as an input.
๏ All boolean values take true or false (not T or F respectively)
๏ Parameter types in SuiteScript 2.0 must match as those listed in the Docs/NetSuite help
๏ Enumeration encapsulated common constants (e.g; standard record types)
๏ Sublists and column indexing begins at 0 (not 1)
… except some rules:
19
Let’s create a simple entry point script:
✓ Shows a message on page load
/**
* @NApiVersion 2.0
* @NScriptType ClientScript
*
*/
define([ 'N/ui/message' ], function(message) {
function showMessage() {
var msgObj = message.create({
title : 'Greeting',
message : 'Hello, welcome!',
type : message.Type.INFORMATION,
});
msgObj.show();
}
return {
pageInit : showMessage,
};
});
• Q: Why a Script Type is ClientScript ?
• Q: What is the name of an entry point
in this script ?
A: “shows a message on page”
(does something on a page)
A: “pageInit”
• Q: What is the name of an entry point
function in this script ?
A: “showMessage”
20
Advantages
and
Drawback
21
Some Advantages of SuiteScript 2.0
Enables us to create our own custom modules
✓ Keeps code DRY (Don’t Repeat Yourself): - One module used by many scripts!!
✓ Abstraction : - Later changes don’t affect the deployed script(s)
✓ Possible to add those modules to SuiteApps and expose them to third parties.
Modern programming syntax and behavior
✓ Modeled to behave and look like modern JavaScript — e.g: No nlapi/nlobj prefix
✓ Third party JavaScript API support
✓ Updated sublist and column indexing — (begins at 0 instead of 1)
Functionality enhancements
✓ MapReduce script type : designed to handle large amounts of data.
‣ automatic yielding without disruption to the script
Automatic Dependency management: No need to remember to order of library files
22
Other Advantages of SuiteScript 2.0
Easier to catch-up for non-NetSuite programmers
Easier to upgrade for future versions: easy as changing the
version number
Good and solid documentation with adequate examples
SuiteScript 2.0 the way forward
23
Optional parameters
[e.g; setAge(age = 18)]
Drawback
JavaScript SuiteScript 2.0
Arrow functions
[e.g; (a, b) => a + b;]
Rest parameters
[e.g; avgAge(…age)]
Block-scoped variables
[ e.g; let age = 18; ]
Mismatching of Scripting-language specification:
- JavaScript’s new version is ECMAScript 8 (partially supported), but SuiteScript 2.0 currently
supports ECMAScript 5
There’s a workaround here!, but haven’t tried it yet!! 24
Ex.:
Coexistence rules
1. SuiteScript 1.0 and 2.0 cannot intermix within the same script
‣ You cannot use 2.0 modules as 1.0 Library scripts
‣ You cannot include 1.0 files as 2.0 dependencies
2. The two versions can intermix in the same account, in the same
application, and can even be deployed on the same record.
SuiteScript 1.0 is still supported. however…
25
…however, SuiteScript 1.0 can be deprecated anytime!!!.
Reference
NetSuite Help Center
https://stoic.software/effective-suitescript/2-ss2-
modules/
26
SuiteScript 2.0 API - Documentation
Thank you
Ad

More Related Content

What's hot (20)

カラムストアインデックス 最初の一歩
カラムストアインデックス 最初の一歩カラムストアインデックス 最初の一歩
カラムストアインデックス 最初の一歩
Masayuki Ozawa
 
The Who, What, Why and How of Active Directory Federation Services (AD FS)
The Who, What, Why and How of Active Directory Federation Services (AD FS)The Who, What, Why and How of Active Directory Federation Services (AD FS)
The Who, What, Why and How of Active Directory Federation Services (AD FS)
Jay Simcox
 
DumpsCafe Microsoft-AZ-104 Free Exam Dumps Demo.pdf
DumpsCafe Microsoft-AZ-104 Free Exam Dumps Demo.pdfDumpsCafe Microsoft-AZ-104 Free Exam Dumps Demo.pdf
DumpsCafe Microsoft-AZ-104 Free Exam Dumps Demo.pdf
Dumps Cafe
 
M20_Azure SQL Database 最新アップデートをまとめてキャッチアップ [Microsoft Japan Digital Days]
M20_Azure SQL Database 最新アップデートをまとめてキャッチアップ [Microsoft Japan Digital Days]M20_Azure SQL Database 最新アップデートをまとめてキャッチアップ [Microsoft Japan Digital Days]
M20_Azure SQL Database 最新アップデートをまとめてキャッチアップ [Microsoft Japan Digital Days]
日本マイクロソフト株式会社
 
IT エンジニアのための 流し読み Windows 10 - Windows 10 サブスクリプションのライセンス認証
IT エンジニアのための 流し読み Windows 10 - Windows 10 サブスクリプションのライセンス認証IT エンジニアのための 流し読み Windows 10 - Windows 10 サブスクリプションのライセンス認証
IT エンジニアのための 流し読み Windows 10 - Windows 10 サブスクリプションのライセンス認証
TAKUYA OHTA
 
Amazon DocumentDB - Architecture 및 Best Practice (Level 200) - 발표자: 장동훈, Sr. ...
Amazon DocumentDB - Architecture 및 Best Practice (Level 200) - 발표자: 장동훈, Sr. ...Amazon DocumentDB - Architecture 및 Best Practice (Level 200) - 발표자: 장동훈, Sr. ...
Amazon DocumentDB - Architecture 및 Best Practice (Level 200) - 발표자: 장동훈, Sr. ...
Amazon Web Services Korea
 
新 Microsoft Edge を Intune で配信・管理する
新 Microsoft Edge を Intune で配信・管理する新 Microsoft Edge を Intune で配信・管理する
新 Microsoft Edge を Intune で配信・管理する
Shinsuke Saito
 
AZ-104-Questions.pdf
AZ-104-Questions.pdfAZ-104-Questions.pdf
AZ-104-Questions.pdf
johnmight400
 
온라인 주문 서비스를 서버리스 아키텍쳐로 구축하기 - 김태우(Classmethod) :: AWS Community Day Online 2020
온라인 주문 서비스를 서버리스 아키텍쳐로 구축하기 - 김태우(Classmethod) :: AWS Community Day Online 2020온라인 주문 서비스를 서버리스 아키텍쳐로 구축하기 - 김태우(Classmethod) :: AWS Community Day Online 2020
온라인 주문 서비스를 서버리스 아키텍쳐로 구축하기 - 김태우(Classmethod) :: AWS Community Day Online 2020
AWSKRUG - AWS한국사용자모임
 
AWS Aurora 운영사례 (by 배은미)
AWS Aurora 운영사례 (by 배은미)AWS Aurora 운영사례 (by 배은미)
AWS Aurora 운영사례 (by 배은미)
I Goo Lee.
 
今さら聞けない!Active Directoryドメインサービス入門
今さら聞けない!Active Directoryドメインサービス入門今さら聞けない!Active Directoryドメインサービス入門
今さら聞けない!Active Directoryドメインサービス入門
Trainocate Japan, Ltd.
 
Azure active directory によるデバイス管理の種類とトラブルシュート事例について
Azure active directory によるデバイス管理の種類とトラブルシュート事例についてAzure active directory によるデバイス管理の種類とトラブルシュート事例について
Azure active directory によるデバイス管理の種類とトラブルシュート事例について
Shinya Yamaguchi
 
Amazon ECS/ECR을 활용하여 마이크로서비스 구성하기 - 김기완 (AWS 솔루션즈아키텍트)
Amazon ECS/ECR을 활용하여 마이크로서비스 구성하기 - 김기완 (AWS 솔루션즈아키텍트)Amazon ECS/ECR을 활용하여 마이크로서비스 구성하기 - 김기완 (AWS 솔루션즈아키텍트)
Amazon ECS/ECR을 활용하여 마이크로서비스 구성하기 - 김기완 (AWS 솔루션즈아키텍트)
Amazon Web Services Korea
 
Microsoft az-104 Dumps
Microsoft az-104 DumpsMicrosoft az-104 Dumps
Microsoft az-104 Dumps
Armstrongsmith
 
最新Active DirectoryによるIDMaaSとハイブリッド認証基盤の実現
最新Active DirectoryによるIDMaaSとハイブリッド認証基盤の実現最新Active DirectoryによるIDMaaSとハイブリッド認証基盤の実現
最新Active DirectoryによるIDMaaSとハイブリッド認証基盤の実現
junichi anno
 
Microsoft azure backup overview
Microsoft azure backup overviewMicrosoft azure backup overview
Microsoft azure backup overview
Sumantro Mukherjee
 
Azure Monitor Logで実現するモダンな管理手法
Azure Monitor Logで実現するモダンな管理手法Azure Monitor Logで実現するモダンな管理手法
Azure Monitor Logで実現するモダンな管理手法
Takeshi Fukuhara
 
Dovecot Director 概要
Dovecot Director 概要Dovecot Director 概要
Dovecot Director 概要
SATOH Fumiyasu
 
Azure仮想マシンと仮想ネットワーク
Azure仮想マシンと仮想ネットワークAzure仮想マシンと仮想ネットワーク
Azure仮想マシンと仮想ネットワーク
Kuninobu SaSaki
 
[SC03] Active Directory の DR 対策~天災/人災/サイバー攻撃、その時あなたの IT 基盤は利用継続できますか?
[SC03] Active Directory の DR 対策~天災/人災/サイバー攻撃、その時あなたの IT 基盤は利用継続できますか? [SC03] Active Directory の DR 対策~天災/人災/サイバー攻撃、その時あなたの IT 基盤は利用継続できますか?
[SC03] Active Directory の DR 対策~天災/人災/サイバー攻撃、その時あなたの IT 基盤は利用継続できますか?
de:code 2017
 
カラムストアインデックス 最初の一歩
カラムストアインデックス 最初の一歩カラムストアインデックス 最初の一歩
カラムストアインデックス 最初の一歩
Masayuki Ozawa
 
The Who, What, Why and How of Active Directory Federation Services (AD FS)
The Who, What, Why and How of Active Directory Federation Services (AD FS)The Who, What, Why and How of Active Directory Federation Services (AD FS)
The Who, What, Why and How of Active Directory Federation Services (AD FS)
Jay Simcox
 
DumpsCafe Microsoft-AZ-104 Free Exam Dumps Demo.pdf
DumpsCafe Microsoft-AZ-104 Free Exam Dumps Demo.pdfDumpsCafe Microsoft-AZ-104 Free Exam Dumps Demo.pdf
DumpsCafe Microsoft-AZ-104 Free Exam Dumps Demo.pdf
Dumps Cafe
 
M20_Azure SQL Database 最新アップデートをまとめてキャッチアップ [Microsoft Japan Digital Days]
M20_Azure SQL Database 最新アップデートをまとめてキャッチアップ [Microsoft Japan Digital Days]M20_Azure SQL Database 最新アップデートをまとめてキャッチアップ [Microsoft Japan Digital Days]
M20_Azure SQL Database 最新アップデートをまとめてキャッチアップ [Microsoft Japan Digital Days]
日本マイクロソフト株式会社
 
IT エンジニアのための 流し読み Windows 10 - Windows 10 サブスクリプションのライセンス認証
IT エンジニアのための 流し読み Windows 10 - Windows 10 サブスクリプションのライセンス認証IT エンジニアのための 流し読み Windows 10 - Windows 10 サブスクリプションのライセンス認証
IT エンジニアのための 流し読み Windows 10 - Windows 10 サブスクリプションのライセンス認証
TAKUYA OHTA
 
Amazon DocumentDB - Architecture 및 Best Practice (Level 200) - 발표자: 장동훈, Sr. ...
Amazon DocumentDB - Architecture 및 Best Practice (Level 200) - 발표자: 장동훈, Sr. ...Amazon DocumentDB - Architecture 및 Best Practice (Level 200) - 발표자: 장동훈, Sr. ...
Amazon DocumentDB - Architecture 및 Best Practice (Level 200) - 발표자: 장동훈, Sr. ...
Amazon Web Services Korea
 
新 Microsoft Edge を Intune で配信・管理する
新 Microsoft Edge を Intune で配信・管理する新 Microsoft Edge を Intune で配信・管理する
新 Microsoft Edge を Intune で配信・管理する
Shinsuke Saito
 
AZ-104-Questions.pdf
AZ-104-Questions.pdfAZ-104-Questions.pdf
AZ-104-Questions.pdf
johnmight400
 
온라인 주문 서비스를 서버리스 아키텍쳐로 구축하기 - 김태우(Classmethod) :: AWS Community Day Online 2020
온라인 주문 서비스를 서버리스 아키텍쳐로 구축하기 - 김태우(Classmethod) :: AWS Community Day Online 2020온라인 주문 서비스를 서버리스 아키텍쳐로 구축하기 - 김태우(Classmethod) :: AWS Community Day Online 2020
온라인 주문 서비스를 서버리스 아키텍쳐로 구축하기 - 김태우(Classmethod) :: AWS Community Day Online 2020
AWSKRUG - AWS한국사용자모임
 
AWS Aurora 운영사례 (by 배은미)
AWS Aurora 운영사례 (by 배은미)AWS Aurora 운영사례 (by 배은미)
AWS Aurora 운영사례 (by 배은미)
I Goo Lee.
 
今さら聞けない!Active Directoryドメインサービス入門
今さら聞けない!Active Directoryドメインサービス入門今さら聞けない!Active Directoryドメインサービス入門
今さら聞けない!Active Directoryドメインサービス入門
Trainocate Japan, Ltd.
 
Azure active directory によるデバイス管理の種類とトラブルシュート事例について
Azure active directory によるデバイス管理の種類とトラブルシュート事例についてAzure active directory によるデバイス管理の種類とトラブルシュート事例について
Azure active directory によるデバイス管理の種類とトラブルシュート事例について
Shinya Yamaguchi
 
Amazon ECS/ECR을 활용하여 마이크로서비스 구성하기 - 김기완 (AWS 솔루션즈아키텍트)
Amazon ECS/ECR을 활용하여 마이크로서비스 구성하기 - 김기완 (AWS 솔루션즈아키텍트)Amazon ECS/ECR을 활용하여 마이크로서비스 구성하기 - 김기완 (AWS 솔루션즈아키텍트)
Amazon ECS/ECR을 활용하여 마이크로서비스 구성하기 - 김기완 (AWS 솔루션즈아키텍트)
Amazon Web Services Korea
 
Microsoft az-104 Dumps
Microsoft az-104 DumpsMicrosoft az-104 Dumps
Microsoft az-104 Dumps
Armstrongsmith
 
最新Active DirectoryによるIDMaaSとハイブリッド認証基盤の実現
最新Active DirectoryによるIDMaaSとハイブリッド認証基盤の実現最新Active DirectoryによるIDMaaSとハイブリッド認証基盤の実現
最新Active DirectoryによるIDMaaSとハイブリッド認証基盤の実現
junichi anno
 
Microsoft azure backup overview
Microsoft azure backup overviewMicrosoft azure backup overview
Microsoft azure backup overview
Sumantro Mukherjee
 
Azure Monitor Logで実現するモダンな管理手法
Azure Monitor Logで実現するモダンな管理手法Azure Monitor Logで実現するモダンな管理手法
Azure Monitor Logで実現するモダンな管理手法
Takeshi Fukuhara
 
Dovecot Director 概要
Dovecot Director 概要Dovecot Director 概要
Dovecot Director 概要
SATOH Fumiyasu
 
Azure仮想マシンと仮想ネットワーク
Azure仮想マシンと仮想ネットワークAzure仮想マシンと仮想ネットワーク
Azure仮想マシンと仮想ネットワーク
Kuninobu SaSaki
 
[SC03] Active Directory の DR 対策~天災/人災/サイバー攻撃、その時あなたの IT 基盤は利用継続できますか?
[SC03] Active Directory の DR 対策~天災/人災/サイバー攻撃、その時あなたの IT 基盤は利用継続できますか? [SC03] Active Directory の DR 対策~天災/人災/サイバー攻撃、その時あなたの IT 基盤は利用継続できますか?
[SC03] Active Directory の DR 対策~天災/人災/サイバー攻撃、その時あなたの IT 基盤は利用継続できますか?
de:code 2017
 

Similar to Suite Script 2.0 API Basics (20)

Dot Net Fundamentals
Dot Net FundamentalsDot Net Fundamentals
Dot Net Fundamentals
LiquidHub
 
Asp.net mvc
Asp.net mvcAsp.net mvc
Asp.net mvc
Phuc Le Cong
 
Nt1310 Unit 3 Language Analysis
Nt1310 Unit 3 Language AnalysisNt1310 Unit 3 Language Analysis
Nt1310 Unit 3 Language Analysis
Nicole Gomez
 
.NET Core Apps: Design & Development
.NET Core Apps: Design & Development.NET Core Apps: Design & Development
.NET Core Apps: Design & Development
GlobalLogic Ukraine
 
Developing Microservices using Spring - Beginner's Guide
Developing Microservices using Spring - Beginner's GuideDeveloping Microservices using Spring - Beginner's Guide
Developing Microservices using Spring - Beginner's Guide
Mohanraj Thirumoorthy
 
Angularjs2 presentation
Angularjs2 presentationAngularjs2 presentation
Angularjs2 presentation
dharisk
 
D22 portlet development with open source frameworks
D22 portlet development with open source frameworksD22 portlet development with open source frameworks
D22 portlet development with open source frameworks
Sunil Patil
 
D22 Portlet Development With Open Source Frameworks
D22 Portlet Development With Open Source FrameworksD22 Portlet Development With Open Source Frameworks
D22 Portlet Development With Open Source Frameworks
Sunil Patil
 
Operator SDK for K8s using Go
Operator SDK for K8s using GoOperator SDK for K8s using Go
Operator SDK for K8s using Go
CloudOps2005
 
.net Framework
.net Framework.net Framework
.net Framework
Rishu Mehra
 
tybsc it asp.net full unit 1,2,3,4,5,6 notes
tybsc it asp.net full unit 1,2,3,4,5,6 notestybsc it asp.net full unit 1,2,3,4,5,6 notes
tybsc it asp.net full unit 1,2,3,4,5,6 notes
WE-IT TUTORIALS
 
Typescript language extension of java script
Typescript language extension of java scriptTypescript language extension of java script
Typescript language extension of java script
michaelaaron25322
 
Migrating to the Isolated worker process in Azure Functions .pptx
Migrating to the Isolated worker process in Azure Functions .pptxMigrating to the Isolated worker process in Azure Functions .pptx
Migrating to the Isolated worker process in Azure Functions .pptx
Callon Campbell
 
Using advanced C# features in Sharepoint development
Using advanced C# features in Sharepoint developmentUsing advanced C# features in Sharepoint development
Using advanced C# features in Sharepoint development
sadomovalex
 
Angular 9
Angular 9 Angular 9
Angular 9
Raja Vishnu
 
.NET Portfolio
.NET Portfolio.NET Portfolio
.NET Portfolio
mwillmer
 
Struts 2 Overview
Struts 2 OverviewStruts 2 Overview
Struts 2 Overview
skill-guru
 
Spring boot
Spring bootSpring boot
Spring boot
NexThoughts Technologies
 
Let’s template
Let’s templateLet’s template
Let’s template
AllenKao7
 
Struts 2-overview2
Struts 2-overview2Struts 2-overview2
Struts 2-overview2
Long Nguyen
 
Dot Net Fundamentals
Dot Net FundamentalsDot Net Fundamentals
Dot Net Fundamentals
LiquidHub
 
Nt1310 Unit 3 Language Analysis
Nt1310 Unit 3 Language AnalysisNt1310 Unit 3 Language Analysis
Nt1310 Unit 3 Language Analysis
Nicole Gomez
 
.NET Core Apps: Design & Development
.NET Core Apps: Design & Development.NET Core Apps: Design & Development
.NET Core Apps: Design & Development
GlobalLogic Ukraine
 
Developing Microservices using Spring - Beginner's Guide
Developing Microservices using Spring - Beginner's GuideDeveloping Microservices using Spring - Beginner's Guide
Developing Microservices using Spring - Beginner's Guide
Mohanraj Thirumoorthy
 
Angularjs2 presentation
Angularjs2 presentationAngularjs2 presentation
Angularjs2 presentation
dharisk
 
D22 portlet development with open source frameworks
D22 portlet development with open source frameworksD22 portlet development with open source frameworks
D22 portlet development with open source frameworks
Sunil Patil
 
D22 Portlet Development With Open Source Frameworks
D22 Portlet Development With Open Source FrameworksD22 Portlet Development With Open Source Frameworks
D22 Portlet Development With Open Source Frameworks
Sunil Patil
 
Operator SDK for K8s using Go
Operator SDK for K8s using GoOperator SDK for K8s using Go
Operator SDK for K8s using Go
CloudOps2005
 
tybsc it asp.net full unit 1,2,3,4,5,6 notes
tybsc it asp.net full unit 1,2,3,4,5,6 notestybsc it asp.net full unit 1,2,3,4,5,6 notes
tybsc it asp.net full unit 1,2,3,4,5,6 notes
WE-IT TUTORIALS
 
Typescript language extension of java script
Typescript language extension of java scriptTypescript language extension of java script
Typescript language extension of java script
michaelaaron25322
 
Migrating to the Isolated worker process in Azure Functions .pptx
Migrating to the Isolated worker process in Azure Functions .pptxMigrating to the Isolated worker process in Azure Functions .pptx
Migrating to the Isolated worker process in Azure Functions .pptx
Callon Campbell
 
Using advanced C# features in Sharepoint development
Using advanced C# features in Sharepoint developmentUsing advanced C# features in Sharepoint development
Using advanced C# features in Sharepoint development
sadomovalex
 
.NET Portfolio
.NET Portfolio.NET Portfolio
.NET Portfolio
mwillmer
 
Struts 2 Overview
Struts 2 OverviewStruts 2 Overview
Struts 2 Overview
skill-guru
 
Let’s template
Let’s templateLet’s template
Let’s template
AllenKao7
 
Struts 2-overview2
Struts 2-overview2Struts 2-overview2
Struts 2-overview2
Long Nguyen
 
Ad

Recently uploaded (20)

The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
Ad

Suite Script 2.0 API Basics

  • 1. SuiteScript 2.0 API Netsuite Released 2015 ∼ July 13, 2018
  • 2. Agenda NetSuite at a glance What is SuiteScript API? Key concepts of SuiteScript 2.0 API SuiteScript 2.0 Syntax HelloWorld Script Advantages of SuiteScript 2.0 Drawback Coexistence rules 1
  • 3. Objectives of this presentation Understanding the basics of SuiteScript 2.0 API Explore the key differences between SuiteScript 1.0 & SuiteScript 2.0 2
  • 4. NetSuite at a glance Cloud-based business management software Software as a Service (SaaS) 3
  • 5. Is a JavaScript API that offers a broad range of options for enhancing and extending NetSuite SuiteScript API What is SuiteScript API? 😟 😎 4
  • 7. SuiteScript 2.0 is modular All SuiteScript 2.0 APIs are organized into modules Each module reflects the functionality Concept #1: 6
  • 8. NetSuite modules & objects record searchlog file NS N create({}) save({})load({}) ∼32 modules e.g: N/file ∼… APIs e.g: record.create({}); setValue({}) …({}) Concept #1 (cont’d) 7 Module must be explicitly loaded by a script before using that module’s API
  • 9. Suitescript 1.0 API Organized in a Single global library JavaScript file. Each file gets loaded to every single script regardless of how much API the script use. Suitescript 2.0 API Organized and grouped into the modules Modules are loaded only when they are needed. — based on Asynchronous Module Definition(AMD) Now Before Modular Concept #1 (cont’d) 8
  • 10. Object as Arguments The arguments passed to methods are typically {key:value} objects var myObject = { fieldId: 'greetingMsg', value: 'Hello, World!' }; myRecord.setValue(myObject); myRecord.setValue({ fieldId: 'greetingMsg', value: ‘Hello, World!' }); Concept #2: 9
  • 11. Suitescript 1.0 API Argument list Suitescript 2.0 API Object as argument Now Before ‣ Objects var myObject = { fieldId: 'greetingMsg', value: 'Hello, World!' }; myRecord.setValue(myObject); nlapiSetFieldValue('greetingMsg', 'Hello, World!'); Concept #2 (cont’d) 10
  • 12. Script types and their Entry pointsConcept #3: Script type: SuiteScript 2.0 scripts consist of several script types Each script type is designed for a specific type of situation and specific types of triggering events Entry point: Represents the juncture at which the system grants control of the NetSuite application to the script. Each script type includes one or more entry points that are exclusive to that type 11
  • 13. UserEventScript ClientScript ScheduledScript … Server (execute on the server) Client (execute in the user’s browser) Script types Entry points ✦ beforeLoad ✦ beforeSubmit ✦ afterSubmit ✦ execute ✦ fieldChange ✦ pageInit ✦ Etc… Concept #3 (cont’d) 12 …
  • 14. Suitescript 1.0 API Scripts are not Expressive: - hard to recognize the purpose of a script Scripts are Dependent: - Actions depend on settings done on NetSuite side Suitescript 2.0 API Expressive scripts - automatically detected by NetSuite Independent scripts - No other enhancements needed. Now Before ‣ JSDocs tags ‣ Script types & Entry points function myFunction(){ // logic here } sample_script.js /** * @NScriptType <script_type_name> */ define([], function() { function myFunction(){ // logic here } return {
 <entry_point_name> : <entry_point_function>
 }; }); sample_script.js Concept #3 (cont’d) 13
  • 15. Entry point scripts & Custom module scriptsKey concept #4: Entry point script: The primary script attached on the script record It identifies the script type, entry points, and entry point functions Each entry point script must include at least one entry point and entry point function Custom module script: Is a user-defined script that holds the logic that can be used by other scripts It’s loaded by an Entry point script as a dependency Script type(s) declaration is not required 14
  • 16. Suitescript 1.0 API Suitescript 2.0 APINow Before NS Script record A Script record B script_A.js script_B.jsscript_A.js script_B.js NS Script record A Script record B script_A.js script_B.js ‣ Custom module scripts Concept #4 (cont’d) 15 Same modules used by- many script records
  • 17. Anatomy of an Entry Point Script /** * @NApiVersion 2.0 * @NScriptType UserEventScript */ define(['N/record', 'N/ui/dialog'], function(record, dialog) { function doBeforeLoad() { /* logic of function*/ } function doBeforeSubmit() { /* logic of function*/ } function doAfterSubmit() { /* logic of function*/ } return { beforeLoad : doBeforeLoad, beforeSubmit: doBeforeSubmit, afterSubmit : doAfterSubmit, }; } ); JSDoc tags: Required for an entry point script Entry points: At least one STANDARD entry point is required for a script type Define’s first argument: List of Dependencies and/or Modules 3 2 1 4 Define’s second argument: Callback function 1. 2. 3. 4. Concept #4 (cont’d) 16
  • 18. Anatomy of a Custom Module Script JSDoc tags: NOT Required for a custom module script, but USEFUL. Entry point: At least one USER-DEFINED entry point is required for a custom module Define’s first argument: List of Dependencies and/or Modules required by the script /** * fileName.js * @NApiVersion 2.x * @ModuleScope Public */ define(['N/record', ’N/search'], function(record, search) { function dummySearch() { /* logic of function*/ } return { myDummySearch : dummySearch, }; } ); 3 2 1 4 Define’s second argument: Callback function 1. 2. 3. 4. Concept #4 (cont’d) 17
  • 20. SuiteScript 2.0 Syntax SuiteScript 2.0 syntax == JavaScript Syntax ๏ SuiteScript 2.0 methods takes plain JavaScript key/value object as an input. ๏ All boolean values take true or false (not T or F respectively) ๏ Parameter types in SuiteScript 2.0 must match as those listed in the Docs/NetSuite help ๏ Enumeration encapsulated common constants (e.g; standard record types) ๏ Sublists and column indexing begins at 0 (not 1) … except some rules: 19
  • 21. Let’s create a simple entry point script: ✓ Shows a message on page load /** * @NApiVersion 2.0 * @NScriptType ClientScript * */ define([ 'N/ui/message' ], function(message) { function showMessage() { var msgObj = message.create({ title : 'Greeting', message : 'Hello, welcome!', type : message.Type.INFORMATION, }); msgObj.show(); } return { pageInit : showMessage, }; }); • Q: Why a Script Type is ClientScript ? • Q: What is the name of an entry point in this script ? A: “shows a message on page” (does something on a page) A: “pageInit” • Q: What is the name of an entry point function in this script ? A: “showMessage” 20
  • 23. Some Advantages of SuiteScript 2.0 Enables us to create our own custom modules ✓ Keeps code DRY (Don’t Repeat Yourself): - One module used by many scripts!! ✓ Abstraction : - Later changes don’t affect the deployed script(s) ✓ Possible to add those modules to SuiteApps and expose them to third parties. Modern programming syntax and behavior ✓ Modeled to behave and look like modern JavaScript — e.g: No nlapi/nlobj prefix ✓ Third party JavaScript API support ✓ Updated sublist and column indexing — (begins at 0 instead of 1) Functionality enhancements ✓ MapReduce script type : designed to handle large amounts of data. ‣ automatic yielding without disruption to the script Automatic Dependency management: No need to remember to order of library files 22
  • 24. Other Advantages of SuiteScript 2.0 Easier to catch-up for non-NetSuite programmers Easier to upgrade for future versions: easy as changing the version number Good and solid documentation with adequate examples SuiteScript 2.0 the way forward 23
  • 25. Optional parameters [e.g; setAge(age = 18)] Drawback JavaScript SuiteScript 2.0 Arrow functions [e.g; (a, b) => a + b;] Rest parameters [e.g; avgAge(…age)] Block-scoped variables [ e.g; let age = 18; ] Mismatching of Scripting-language specification: - JavaScript’s new version is ECMAScript 8 (partially supported), but SuiteScript 2.0 currently supports ECMAScript 5 There’s a workaround here!, but haven’t tried it yet!! 24 Ex.:
  • 26. Coexistence rules 1. SuiteScript 1.0 and 2.0 cannot intermix within the same script ‣ You cannot use 2.0 modules as 1.0 Library scripts ‣ You cannot include 1.0 files as 2.0 dependencies 2. The two versions can intermix in the same account, in the same application, and can even be deployed on the same record. SuiteScript 1.0 is still supported. however… 25 …however, SuiteScript 1.0 can be deprecated anytime!!!.