This topic contains 3 replies, has 0 voices, and was last updated by ironside 8 years, 1 month ago.
-
AuthorPosts
-
September 20, 2016 at 7:55 am #1793
darrenhillconsultingOk,
Hoping this is an easy one (that’s somehow eluded me). I want to create a simply library that holds an enumeration of id’s, so that I can use it across several. Easy Peasy in SS 1.0, but how do I do that in SS 2.0?
This is a cached copy. Click here to see the original post. -
September 20, 2016 at 8:46 am #1794
david.smithJust create it as a javascript object in a separate file. In your define just call on the file.
Code:
define([‘N/record’, ‘N/search’, ‘N/ui/serverWidget’,’./js/createHtmlTable’, ‘N/file’,’./accounting’],
/**
* @param {record} record
* @param {search} search
* @param {serverWidget} serverWidget
*/
function(record, search, serverWidget,table,file,accounting) { -
September 20, 2016 at 1:57 pm #1795
chanarbonHi Darren,
I agree with David’s note above. You simply need to create a javascript file that is SuiteScript 2.0 compliant similar to the one below
Code:
/**
*
* @NModuleScope TargetAccount
*
*/define([“N/record”, “N/email”, “N/search”], function(record, email, search){
function fxn1(){
….
}function fxn2(){
….
}return {
libFxn1 : fxn1,
libFxn2 : fxn2
}})
Then calling it would be simply following the details on Module Dependency Path (https://netsuite.custhelp.com/app/an…il/a_id/45053/) or require.config() (https://netsuite.custhelp.com/app/an…il/a_id/50900/)Please note that the name of the functions when used on your scripts would be the aliases declared on the return object of your library.
-
September 22, 2016 at 6:36 pm #1796
ironsideTypeScript:
file ‘myEnums.ts’ in same file cabinet folder as ‘myScript.ts’
PHP Code:
export enum MyEnum { foo,bar,baz }
file ‘myScript.ts’
PHP Code:
import {MyEnum} from ‘./myEnums’
var x:MyEnum = MyEnum.foo
-
AuthorPosts
You must be logged in to reply to this topic.