Sie sind auf Seite 1von 20

SuiteScript

Version 2011 Release 1

Pre-Class
Setup Guide
©2000 - 2011 NetSuite Inc.

Any reproduction or distribution of any part of this document without the prior
written permission of NetSuite Inc. is strictly prohibited.

The information included in this document is confidential and proprietary information


of NetSuite Inc.

First printing: April 2011

NetSuite Inc.
2955 Campus Drive, Suite 100
San Mateo, CA. 99403-2511
Module 00
Configure your Development Environment

00 - 01: Setting up Eclipse

Scenario Install the Eclipse IDE for JavaScript Web Developers, v3.6 or
higher.

Note: The training class uses Eclipse as the IDE for developing
SuiteScript; but as a participant, you’re not limited to using Eclipse.
The only requirement for developing JavaScripts is a text editor, so
even Notepad will work. We strongly recommend though that you
use Eclipse if you’re not too experienced with developing JavaScripts.
The instructions contained in this document include installation of
Aptana and NetSuite plug-ins for Eclipse, enhancing your script
development productivity.

You can also use an older copy of Eclipse (prior to v3.6), but take
note the Aptana plug-in works best on v3.6 or higher.

A link to other JavaScript IDEs and editors will be provided at the


end of this section.

Requirements  Download and install Eclipse


 Install the Aptana Studio 2 plug-in
 Install the NetSuite plug-in
 Update the SuiteScript API file

Duration 15 – 25 minutes

Download and install Eclipse

1. Go to the Eclipse Downloads page: http://www.eclipse.org/downloads/

2. Select Eclipse IDE for JavaScript Web Developers, 32-bit or 64-bit.

Note: Eclipse needs a Java runtime environment (JRE) to run. If your computer
doesn’t have a JRE yet, go to the Free Java Download page
http://www.java.com/getjava/ and install it.

Note: You need to download either the 32-bit or 64-bit version, depending of
your Windows system. If you’re not sure what version you need, go to
the Windows System Properties to check. Links to the Linux and Mac
versions are available if you click on the Details link or the version

Exercises Page 3
name. This could also be available on the dropdown menu beside the
Eclipse version number.

3. Click on the green download icon or the server name to initiate the download.

4. Save the zip file to a temporary directory. The file is more than 100MB, so it may
take a while depending on your internet connection.

5. Unzip the file into your desired location. It is suggested that you unzip the file to
the root directory of your C drive (Windows). A folder named eclipse is created
wherever you extract the zip.

Install the Aptana plug-in

The Aptana Studio 2 plug-in enhances your JavaScript development experience with
Eclipse by adding features such as code completion, syntax highlighting, code
formatting, etc.

6. Start Eclipse by navigating to the eclipse directory, executing eclipse.exe.

Page 4 SuiteScript
7. The first time you start Eclipse, you are prompted to set a workspace directory.
You can keep the default or change to some other directory.

Check Use this as the default and do not ask again.

8. Running Eclipse for the first time displays the Welcome tab.

Exercises Page 5
9. Go to Help then click on Install New Software…

10. On the Install dialog box, click on the Add... button.

11. On the Add Repository window, type in the plug-in Name and Location then
click OK.
Name : Aptana Studio 2
Location : http://download.aptana.com/tools/studio/plugin/install/studio

Note: The Location is case sensitive!

Page 6 SuiteScript
12. On the Install window, select Aptana Studio and click Next.

Note: It may take several minutes for the system to move to the next step.

13. Keep clicking Next until the software starts to install. Click I accept when
prompted to review the user license.

Exercises Page 7
14. In case you are prompted for a security warning, click OK.

15. Restart Eclipse when prompted.

Install the NetSuite plug-in

The NetSuite plugin is used to immediately upload a script file to the file cabinet
without the need to login to the NetSuite application. Though not required, this helps
make development faster.

Note: The steps in installing Eclipse plug-ins are the same; the only thing that
changes is the name and the Repository URL.

16. In Eclipse, navigate to Help > Install New Software...

17. Click on the Add... button

18. On the Add Repository window, type in the plug-in Name and Location:
Name : NetSuite
Location : http://suitesource.netsuite.com/site/NetSuiteEclipsePlug-in/site.xml

Note: The Location is case sensitive!

19. Select IDE.

Page 8 SuiteScript
20. Keep clicking Next until the software starts to install. Click I accept when
prompted to review the user license.

In case you are prompted for a security warning, click OK.

21. Restart Eclipse when prompted.

Update the SuiteScript API file

Installing the NetSuite plugin also automatically adds the SuiteScript API file to Aptana
(used for code completion), but downloading the latest file from NetSuite makes sure
that it’s updated.
22. Download the latest SuiteScript API (nlapihandler.js) from
https://system.netsuite.com/app/common/scripting/nlapihandler.nl?downloadapi=T.

Note: This link does not require you to be logged into a NetSuite account.
If you have access to a NetSuite account prior to class, you can access the same
file by navigating to the File Cabinet (Documents > Files > File Cabinet) and

Exercises Page 9
selecting SuiteScript API:

23. Save the file to any location (e.g. C drive).


Note: You may be prompted to save the file with a .nl extension. Change this to
a .js extension so the file can be found in Eclipse (next set of steps).
24. Go to Eclipse and navigate to Window > Open Perspective > Other...

25. Select Aptana Web.

26. Click on the References view, then click on the Global References section to
expand it.

Page 10 SuiteScript
Exercises Page 11
27. Click on the green plus icon and select the SuiteScript API file that you’ve just
downloaded.

28. It is successfully added as a reference if it appears on the Global References


section.

Page 12 SuiteScript
Note: If you installed the NetSuite plug-in before you updated the SuiteScript
API file, you will see a SuiteScript Library entry. Uncheck this as this
may be an older version of the SuiteScript API.

Alternative JavaScript IDE and editors

Here’s a list of other IDEs and editors for developing SuiteScripts

1. Netbeans IDE
NetBeans is a full-fledged IDE similar to Eclipse with versions for Linux and Mac.
There is no NetSuite plugin for Netbeans though.
For more information about Netbeans, visit
http://netbeans.org/features/javascript/.

2. Aptana Studio 2 IDE


Not to be confused with the Aptana Studio 2 plug-in, Aptana Studio IDE is an IDE
that’s built on top of Eclipse. This means that the user interface is practically the
same and that anything that’s compatible with Eclipse will theoretically be
compatible with Aptana (this includes the NetSuite plugin).
For more information about Aptana Studio 2 IDE, visit
http://www.aptana.com/products/studio2

3. Notepad++

Unlike Eclipse and Netbeans, Notepad++ is not an IDE but an advanced text
editor. The advantage of using Notepad++ is that it’s light and perfect for doing
quick changes to the script. There’s even a portable version that you could put
on your USB flash disk and run anywhere.

For more information about Notepad++, visit http://notepad-plus-plus.org/.

Exercises Page 13
00 - 02: Setting up a Client-Side Debugger

Scenario Install a client-side debugger for your browser. This is not a


requirement, but does make troubleshooting some types of
SuiteScripts easier. The instructor will demonstrate some of the
client-side debuggers during the course.

Note: You don’t need to install all the debuggers, only the
debuggers for the browsers you’ll be using during the training.

Requirements  Install the Firebug plug-in for Firefox


 Launch the Developer Tools for Internet Explorer
 Launch the Developer tools for Chrome
 Enable the Develop menu in Safari

Duration 5 – 10 minutes

Install the Firebug plug-in for Firefox

1. Open up your Firefox browser and go to the Tools menu then click on Add-
ons.

2. In the Add-ons window, click on the Get Add-ons and type Firebug in the
search box. Hit the enter key to perform the search.

3. Select Firebug and click on the Add to Firefox… button to install it.

Page 14 SuiteScript
Note: FlashFirebug in the above screenshot is not the correct add-on!

Note: If Firebug is not the top option, then check if it’s already installed on your
browser by clicking on the Extensions option on the top part of the window
then checking if Firebug is already listed. If it’s not yet installed, go back to
the Get Add-ons section and click the See all results or Browse All Add-
ons links to download it from the Mozilla Add-ons webpage.

4. To initiate the installation, an installation confirmation window will appear. Just


click the Install button.

Exercises Page 15
5. Restart Firefox when prompted.

6. If the installation was successful, the Firebug icon should appear on the lower
right hand corner of your Firefox browser.

7. Open Firebug by clicking on the icon, or by pressing the F12 key or by


navigating to Tools > Firebug > Open Firebug

8. Click on the down arrow beside the Script tab then select Enabled.

Launch the Developer Tools for Internet Explorer

Unlike Firefox, Internet Explorer has a built-in script debugger called


Developer Tools.

Note: This is true of Internet Explorer 8 and later versions. Internet Explorer 7
and earlier versions requires a separate download, and the debugger differs from the
following instructions.

1. To open Developer Tools for IE, navigate to Tools then click on


Developer Tools or click F12.

2. To start debugging, click on the Start Debugging button.

Page 16 SuiteScript
Note: The webpage you’re debugging needs to be refreshed for the debugger to
catch the running scripts.

Launch the Developer tools for Chrome

Chrome also has a built-in debugger that’s ported to the bottom of the browser,
similar to Firebug.

1. Click on the wrench icon on the upper right hand corner of the browser. Navigate
to Tools then click on Developer tools.

Exercises Page 17
2. Click on the Scripts tab to view the loaded scripts.

Enable the Develop menu in Safari

Safari also has a built in JavaScript debugger that can be launch from the Develop
menu. It’s also ported to the bottom of the browser and looks very similar to the
Chrome Developer tools.

1. Enable the Develop menu by clicking the gear icon on the upper right hand
corner of the browser and selecting Preferences.

Page 18 SuiteScript
2. In the Preferences window, navigate to the Advanced tab then enable the
Show Develop menu in menu bar option.

Note: Closing the window applies the change.

3. Navigate to the Develop menu and click on the Start Debugging JavaScript
option.

NOTE: If the menu options don’t appear, try pressing the <Alt> key.

Exercises Page 19
4. Click on the Scripts tab to view the loaded scripts.

Page 20 SuiteScript

Das könnte Ihnen auch gefallen