vagrant up
vagrant ssh
to login to the virtual boxforever start iosuite.js
The iosuite Framework uses a strict coding standard based off of a traditional class based structure. To see an example, check out the sample suitelet provided. This includes a Client Script and a Restlet. Below is a sample of the structure
(function(){ var private = {}; public.libraries.global = {{library:global}}; public.load = function( dataIn ) { var response = '', context = nlapiGetContext(), html = {{template:sample}}, tags = {}, employeeFilters = [], employeeColumns = [], employeeRecord; /* * Set Filters and Columns */ employeeFilters.push( new nlobjSearchFilter('internalid', null, 'is', context.getUser() ) ); employeeColumns.push( new nlobjSearchColumn('title') ); try { employeeRecord = nlapiSearchRecord('employee', null, employeeFilters, employeeColumns); } catch(error) { public.libraries.global.handleError( error, 'ERROR' ); } tags.company = context.getCompany(); tags.environment = context.getEnvironment(); tags.version = context.getVersion(); tags.email = context.getEmail(); tags.username = context.getName(); tags.jobtitle = employeeRecord[0].getValue('title') || 'Not Set'; tags.userid = context.getUser(); response = public.libraries.global.mapTags( html, tags ); return response; }; return public; })();
The above piece of code is wrapped inside of a self executing function using the (function(){})(); notation. At the beginning there is a local scoped private variable set, where the public variable has been declared and used in the master control file. Then the Suitelet load()
method is declared.
It is important to node, there are specific methods that MUST be declared in order for the Suitelet/Restlet to work. For Suitelets it's public.load(), for RESTlets it is public.createCall(), public.readCall(), public.updateCall(), and public.deleteCall();
Other methods are declared but have not been enabled on the live iosuite branch
iosuite comes with several templating systems. The first one allows you to declare libraries, html/css/js calls, among other things. The second is the global library, the global library allows for templating inside of an HTML file. See the sample suitelet for a use case
The MIT License (MIT)
Copyright (c) 2015 SRS Acquiom
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name(s) of the above copyright holders shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization.