├── README.md ├── analytics.js ├── cache.js ├── communication.js ├── configuration.js ├── currency.js ├── date.js ├── encryption.js ├── error.js ├── executionContext.js ├── field.js ├── file.js ├── jobManager.js ├── portlet.js ├── record.js ├── scheduling.js ├── search.js ├── sublist.js ├── subrecord.js ├── suiteFlow.js ├── template.js ├── transaction.js ├── ui.js ├── userCredentials.js └── xml.js /README.md: -------------------------------------------------------------------------------- 1 | # SuiteScript API 2 | **IDE friendly NetSuite Documentation** 3 | 4 | 5 | A lot of this information can be found around the internet, 6 | but it's hard to find it all in any single location or format. 7 | 8 | This resource aims to be a better place for up to date API docs as 9 | each bi-annual update of SuiteScript tends to include a few 10 | small changes of function signatures. 11 | 12 | 13 | Pull requests welcome. 14 | -------------------------------------------------------------------------------- /analytics.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SuiteScript SuiteAnalytics APIs 3 | */ 4 | 5 | 6 | /** 7 | * Creates an instance of a report definition object. 8 | * 9 | * The report is built on this object using subsequent methods. The report definition can be used 10 | * to create a form for rendering the pivot table report in a browser, or the pivot table APIs 11 | * can be used to extract the values of the individual rows and columns of the pivot table. 12 | * 13 | * @return {nlobjReportDefinition} 14 | * @since 2012.2 15 | */ 16 | function nlapiCreateReportDefinition() { 17 | } 18 | 19 | /** 20 | * Creates an nlobjReportForm object to render the report definition. 21 | * 22 | * @param {string} title The title of the form 23 | * 24 | * @return {nlobjReportForm} 25 | * @since 2012.2 26 | */ 27 | function nlapiCreateReportForm(title) { 28 | } 29 | 30 | /** 31 | * Object used to encapsulate a pivot table column 32 | * 33 | * @constructor 34 | * @since 2012.2 35 | */ 36 | function nlobjPivotColumn() { 37 | } 38 | 39 | /** 40 | * @return {string} 41 | * @since 2012.2 42 | */ 43 | nlobjPivotColumn.prototype.getAlias = function() { 44 | }; 45 | 46 | /** 47 | * @return {nlobjPivotColumn|null} 48 | * @since 2012.2 49 | */ 50 | nlobjPivotColumn.prototype.getParent = function() { 51 | }; 52 | 53 | /** 54 | * @return {string} 55 | * @since 2012.2 56 | */ 57 | nlobjPivotColumn.prototype.getLabel = function() { 58 | }; 59 | 60 | /** 61 | * @return {nlobjPivotColumn|null} 62 | * @since 2012.2 63 | */ 64 | nlobjPivotColumn.prototype.getSummaryLine = function() { 65 | }; 66 | 67 | /** 68 | * @return {Object} 69 | * @since 2012.2 70 | */ 71 | nlobjPivotColumn.prototype.getValue = function() { 72 | }; 73 | 74 | /** 75 | * @return {nlobjPivotColumn[]|null} Null if no children columns exist 76 | * @since 2012.2 77 | */ 78 | nlobjPivotColumn.prototype.getVisibleChildren = function() { 79 | }; 80 | 81 | /** 82 | * @return {boolean} 83 | * @since 2012.2 84 | */ 85 | nlobjPivotColumn.prototype.isHidden = function() { 86 | }; 87 | 88 | /** 89 | * Object used to encapsulate a pivot table row 90 | * 91 | * @constructor 92 | * @since 2012.2 93 | */ 94 | function nlobjPivotRow() { 95 | } 96 | 97 | /** 98 | * @return {string} 99 | * @since 2012.2 100 | */ 101 | nlobjPivotRow.prototype.getAlias = function() { 102 | }; 103 | 104 | /** 105 | * @return {nlobjPivotRow[]|null} Null if the row is a detail line or if there are no children 106 | * @since 2012.2 107 | */ 108 | nlobjPivotRow.prototype.getChildren = function() { 109 | }; 110 | 111 | /** 112 | * @return {string} 113 | * @since 2012.2 114 | */ 115 | nlobjPivotRow.prototype.getLabel = function() { 116 | }; 117 | 118 | /** 119 | * @return {nlobjPivotRow|null} Null if the row does not exist 120 | * @since 2012.2 121 | */ 122 | nlobjPivotRow.prototype.getParent = function() { 123 | }; 124 | 125 | /** 126 | * @return {nlobjPivotRow|null} Null if the row is a detail line 127 | * @since 2012.2 128 | */ 129 | nlobjPivotRow.prototype.getSummaryLine = function() { 130 | }; 131 | 132 | /** 133 | * @param {nlobjPivotColumn} [pivotColumn] 134 | * 135 | * @return {Object|null} The value of the row hierarchy, or null if isDetailLine returns false 136 | * @since 2012.2 137 | */ 138 | nlobjPivotRow.prototype.getValue = function(pivotColumn) { 139 | }; 140 | 141 | /** 142 | * @return {boolean} 143 | * @since 2012.2 144 | */ 145 | nlobjPivotRow.prototype.isDetailLine = function() { 146 | }; 147 | 148 | /** 149 | * @constructor 150 | * @since 2012.2 151 | */ 152 | function nlobjPivotTable() { 153 | } 154 | 155 | /** 156 | * @return {nlobjPivotRow} 157 | * @since 2012.2 158 | */ 159 | nlobjPivotTable.prototype.getColumnHierarchy = function() { 160 | }; 161 | 162 | /** 163 | * @return {nlobjPivotRow} 164 | * @since 2012.2 165 | */ 166 | nlobjPivotTable.prototype.getRowHierarchy = function() { 167 | }; 168 | 169 | /** 170 | * Handle to the pivot table object. A handle is a reference which points to the pivot table 171 | * 172 | * @constructor 173 | * @since 2012.2 174 | */ 175 | function nlobjPivotTableHandle() { 176 | } 177 | 178 | /** 179 | * Get the pivot table object from the report definition 180 | * 181 | * Note: This is a blocking call and it will wait until the report definition execution has finished. 182 | * Using isReady() is recommended to check execution state if blocking is unacceptable. 183 | * 184 | * @return {nlobjPivotTable} 185 | * @since 2012.2 186 | */ 187 | nlobjPivotTableHandle.prototype.getPivotTable = function() { 188 | }; 189 | 190 | /** 191 | * Returns the completion status flag of the report definition execution 192 | * 193 | * @return {boolean} 194 | * @since 2012.2 195 | */ 196 | nlobjPivotTableHandle.prototype.isReady = function() { 197 | }; 198 | 199 | /** 200 | * Object used to encapsulate a report column on a pivot report. 201 | * 202 | * @constructor 203 | * @since 2012.2 204 | */ 205 | function nlobjReportColumn() { 206 | } 207 | 208 | /** 209 | * @return {string|null} 210 | * @since 2012.2 211 | */ 212 | nlobjReportColumn.prototype.getFormula = function() { 213 | }; 214 | 215 | /** 216 | * @return {nlobjReportColumnHierarchy} 217 | * @since 2012.2 218 | */ 219 | nlobjReportColumn.prototype.getParent = function() { 220 | }; 221 | 222 | /** 223 | * @return {boolean} 224 | * @since 2012.2 225 | */ 226 | nlobjReportColumn.prototype.isMeasure = function() { 227 | }; 228 | 229 | /** 230 | * Object used to encapsulate the report column hierarchy 231 | * 232 | * @constructor 233 | * @since 2012.2 234 | */ 235 | function nlobjReportColumnHierarchy() { 236 | } 237 | 238 | /** 239 | * Get the children reference of this column hierarchy 240 | * 241 | * @return {nlobjReportColumnHierarchy} 242 | * @since 2012.2 243 | */ 244 | nlobjReportColumnHierarchy.prototype.getChildren = function() { 245 | }; 246 | 247 | /** 248 | * @return {nlobjReportColumnHierarchy|null} 249 | * @since 2012.2 250 | */ 251 | nlobjReportColumnHierarchy.prototype.getParent = function() { 252 | }; 253 | 254 | /** 255 | * The primary object that contains the definition of the report 256 | * 257 | * @constructor 258 | * @since 2012.2 259 | */ 260 | function nlobjReportDefinition() { 261 | } 262 | 263 | /** 264 | * Add a column to the report definition 265 | * 266 | * @param {string} alias 267 | * @param {boolean} isMeasure 268 | * @param {string} label The column label that will be displayed on the report. 269 | * @param {nlobjReportColumnHierarchy} [parent] The reference to the parent column in the hierarchy. 270 | * If null, then this column will not be associated with a parent column. 271 | * @param {string} format The data type that this column represents. 272 | * @param {string} [formula] A string which describes a mathematical formula in the format 273 | * of “F(x,y,z) = mathematical function”, where x,y,z are previously defined 274 | * aliases from addRowHierarchy, addColumnHierarchy, or addColumn calls. 275 | * 276 | * @return {nlobjReportColumn} The reference to the nlobjReportColumn object. 277 | * @since 2012.2 278 | */ 279 | nlobjReportDefinition.prototype.addColumn = function(alias, isMeasure, label, parent, format, formula) { 280 | }; 281 | 282 | /** 283 | * 284 | * @param {string} alias 285 | * @param {string} label 286 | * @param {nlobjReportColumnHierarchy} [parent] The reference of the parent column in the hierarchy. 287 | * If null, then this column will be the root (top level) column. 288 | * @param {string} format 289 | * 290 | * @return {nlobjReportColumnHierarchy} The reference to the nlobjReportColumnHierarchy object. 291 | * @since 2012.2 292 | */ 293 | nlobjReportDefinition.prototype.addColumnHierarchy = function(alias, label, parent, format) { 294 | }; 295 | 296 | /** 297 | * 298 | * @param {string} alias 299 | * @param {string} label 300 | * @param {string} format 301 | * 302 | * @return {nlobjReportRowHierarchy} The reference to the nlobjReportRowHierarchy object. 303 | * @since 2012.2 304 | */ 305 | nlobjReportDefinition.prototype.addRowHierarchy = function(alias, label, format) { 306 | }; 307 | 308 | /** 309 | * Attaches a search as a data source to the report definition. 310 | * 311 | * @param {string} searchType 312 | * @param {string} id The internal id if you are using a saved search as a data source. 313 | * @param {nlobjSearchFilter[]} filters Note: Search filter expression as filters parameter is currently not supported. 314 | * @param {nlobjSearchColumn[]} columns 315 | * @param {string} map The mapping of rows/columns of the search to the report. 316 | * 317 | * @return {void} 318 | * @since 2012.2 319 | */ 320 | nlobjReportDefinition.prototype.addSearchDatasource = function(searchType, id, filters, columns, map) { 321 | }; 322 | 323 | /** 324 | * Creates the form for rendering from the report definition 325 | * 326 | * Note: Only one synchronous pivot table execution is allowed at a time. 327 | * If a second synchronous execution is called, it will invalidate the first pivot table. 328 | * 329 | * @param {nlobjReportForm} [form] The form object created with nlapiCreateReportForm. 330 | * If not specified the call waits until the execution is finished (synchronous) 331 | * and an nlobjPivotTable will be available from the handle. If the parameter is set, 332 | * the call returns immediately and the returned value references the nlobjReportForm 333 | * - a pivot table handle will not be available in this case. 334 | * 335 | * @return {nlobjPivotTableHandle} The identifier of the pivot table handle, or nlobjReportForm 336 | * @since 2012.2 337 | */ 338 | nlobjReportDefinition.prototype.executeReport = function(form) { 339 | }; 340 | 341 | /** 342 | * 343 | * @param {string} [title] 344 | * 345 | * @return {void} 346 | * @since 2012.2 347 | */ 348 | nlobjReportDefinition.prototype.setTitle = function(title) { 349 | }; 350 | 351 | /** 352 | * Object used to encapsulate the report form and render the report in HTML 353 | * 354 | * @constructor 355 | * @since 2012.2 356 | */ 357 | function nlobjReportForm() { 358 | } 359 | 360 | /** 361 | * Object used to encapsulate the report row hierarchy 362 | * 363 | * @constructor 364 | * @since 2012.2 365 | */ 366 | function nlobjReportRowHierarchy() { 367 | } 368 | 369 | /** 370 | * @return {nlobjReportRowHierarchy} The child reference to the nlobjReportRowHierarchy object 371 | * @since 2012.2 372 | */ 373 | nlobjReportRowHierarchy.prototype.getChildren = function() { 374 | }; 375 | 376 | /** 377 | * @return {nlobjReportRowHierarchy|null} Either the parent reference to the nlobjReportRowHierarchy object or null. 378 | * @since 2012.2 379 | */ 380 | nlobjReportRowHierarchy.prototype.getChildren = function() { 381 | }; 382 | -------------------------------------------------------------------------------- /cache.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SuiteScript Cache APIs 3 | */ 4 | 5 | 6 | /** 7 | * Get a cache object 8 | * 9 | * @param {string} name of the cache 10 | * 11 | * @return {nlobjCache} 12 | * @since 2013.2 13 | */ 14 | function nlapiGetCache(name) { 15 | } 16 | 17 | /** 18 | * @constructor 19 | * @since 2013.1 20 | */ 21 | function nlobjCache() { 22 | } 23 | 24 | /** 25 | * @param {string} key 26 | * @param {string} value 27 | * @param {int} ttl time to live in seconds 28 | * @return {Object} status 29 | * @since 2013.2 30 | */ 31 | nlobjCache.prototype.put = function(key, value, ttl) { 32 | }; 33 | 34 | /** 35 | * @param {string} key 36 | * @return {string} value associate with that key 37 | * @since 2013.2 38 | */ 39 | nlobjCache.prototype.get = function(key) { 40 | }; 41 | 42 | /** 43 | * @param {string} key 44 | * @return {Object} status 45 | * @since 2013.2 46 | */ 47 | nlobjCache.prototype.remove = function(key) { 48 | }; 49 | -------------------------------------------------------------------------------- /communication.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SuiteScript Communication APIs 3 | * 4 | * Use these APIs to communicate to external systems from within NetSuite. 5 | */ 6 | 7 | 8 | /** 9 | * Return a URL with a generated OAuth token 10 | * 11 | * Note that you must have the SuiteSignOn feature enabled in your account before you can use SuiteSignOn functionality 12 | * 13 | * Note: Once the SuiteSignOn record is saved, both the scriptId and system-generated ID are prefixed with 'customsso' 14 | * 15 | * @restriction User event, Suitelets and Portlets only 16 | * @governance 20 units 17 | * 18 | * @param {string} id The custom scriptId specified on the SuiteSignOn record. 19 | * NetSuite recommends you create a custom scriptId for each SuiteSignOn record to avoid naming 20 | * conflicts should you decide use SuiteBundler to deploy your scripts into other accounts. 21 | * If you do not create a custom scriptId, a system-generated ID will be generated for you once 22 | * the SuiteSignOn record is saved. You can also use the system-generated ID as the id value. 23 | * 24 | * @return {string} URL, OAuth token, and any integration variables as a string 25 | * @exception {SSS_SUITESIGNON_NOT_CONFIGURED} 26 | * @exception {SSS_INVALID_SUITESIGNON} 27 | * @since 2009.2 28 | */ 29 | function nlapiOutboundSSO(id) { 30 | } 31 | 32 | /** 33 | * Requests an HTTP(s) URL (internal or external) 34 | * 35 | * Note a timeout occurs if the initial connection takes > 5 seconds and/or the request takes > 45 to respond. 36 | * nlapiRequestURL(...) automatically encodes binary content using base64 representation, 37 | * since JavaScript is a character-based language with no support for binary types. 38 | * This means you can take the contents returned and save them in the NetSuite file cabinet as a file 39 | * or stream them directly to a response. 40 | * 41 | * Also note that if you call nlapiRequestURL(...), passing in the header with a content type, 42 | * NetSuite respects only the following two types: 43 | * • "application/json" 44 | * • "application/soap+xml" 45 | * Otherwise, NetSuite will overwrite the content type with our default type as if the type had not 46 | * been specified. NetSuite default types are: 47 | * • "text/xml; charset=UTF~8" 48 | * • "application/x-www-form-urlencoded; charset=UTF~8" 49 | * 50 | * Additionally, nlapiRequestURL(...) calls from the server do not include the current user's session information. 51 | * This means you can only use this API to request Suitelets that are set to available 52 | * without login using the external URL. 53 | * 54 | * This API is supported in client, user event, scheduled, portlet, and Suitelet scripts. 55 | * 56 | * @governance 10 units 57 | * 58 | * @param {string} url The HTTP(s) URL being requested - (fully qualified unless NetSuite page) 59 | * @param {string|Object} [postdata] Body used for a POST request. It can either be an associative array of 60 | * form parameters or a string. If set to null, then a GET request is used. 61 | * @param {Object} [headers] An associative array of name (header) value (header value) pairs 62 | * @param {function} [callback] A callback function called when the request is completed (Client SuiteScript only). 63 | * If you specify a callback in Client SuiteScript, the request is processed asynchronously, 64 | * and once it is processed, the callback is called/invoked. 65 | * If you know your request may take a long time and you do not want to impair user experience, 66 | * it is recommended that you set the callback function within nlapiRequestURL so that 67 | * the request is processed asynchronously. If a callback function is specified, 68 | * then the response will be passed, instead to the callback function, upon completion. 69 | * However, if validation is needed, nlapiRequestURL should run synchronously and the 70 | * callback function should be omitted from nlapiRequestURL. 71 | * The function is passed an nlobjServerResponse with the results. 72 | * @param {string} [httpMethod] Specify the appropriate http method to use for your integration. 73 | * Supported http methods are HEAD, DELETE and PUT. This parameter allows for easier 74 | * integration with external RESTful services using the standard REST functions. 75 | * Note that if the httpMethod parameter is empty or not specified, this behavior is followed: 76 | * the method is POST if postdata is not empty. The method is GET if it is. 77 | * Be aware that the httpMethod parameter overrides, so you can specify GET and specify postdata, 78 | * NetSuite will do a GET and ignore the postdata. 79 | * 80 | * @return {nlobjServerResponse|void} void if a callback function has been specified 81 | * @exception {SSS_REQUEST_TIME_EXCEEDED} if the connection exceeds the 45 second timeout period 82 | * @exception {SSS_UNKNOWN_HOST} 83 | * @exception {SSS_INVALID_HOST_CERT} 84 | * @since 2007.0 85 | */ 86 | function nlapiRequestURL(url, postdata, headers, callback, httpMethod) { 87 | } 88 | 89 | /** 90 | * Allows you to send credentials outside of NetSuite 91 | * 92 | * This API securely accesses a handle to credentials users specify in a NetSuite credential field. 93 | * 94 | * Note: NetSuite credential fields can be added to Suitelets using the 95 | * nlobjForm.addCredentialField(id, label, website, scriptId, value, entityMatch, tab) method. 96 | * 97 | * Note a timeout occurs if the initial connection takes > 5 seconds and/or the request takes > 45 to respond. 98 | * nlapiRequestURL(...) automatically encodes binary content using base64 representation, 99 | * since JavaScript is a character-based language with no support for binary types. 100 | * This means you can take the contents returned and save them in the NetSuite file cabinet as a file 101 | * or stream them directly to a response. 102 | * 103 | * Also note that if you call nlapiRequestURLWithCredentials(...), passing in the header with a content type, 104 | * NetSuite respects only the following two types: 105 | * • "application/json" 106 | * • "application/soap+xml" 107 | * Otherwise, NetSuite will overwrite the content type with our default type as if the type had not 108 | * been specified. NetSuite default types are: 109 | * • "text/xml; charset=UTF~8" 110 | * • "application/x-www-form-urlencoded; charset=UTF~8" 111 | * 112 | * This API is supported in client, user event, scheduled, portlet, and Suitelet scripts. 113 | * 114 | * @governance 10 units 115 | * 116 | * @param {string} credentials List of credential handles. This API does not know where you have stored the data, 117 | * it only knows the credentials to use by handle. Therefore, if you have multiple credentials for 118 | * a single call, you will need a list. The handles are 32 byte, globally unique strings (GUIDs). 119 | * @param {string} url The HTTP(s) URL being requested - (fully qualified unless NetSuite page) 120 | * @param {string|Object} [postdata] Body used for a POST request. It can either be an associative array of 121 | * form parameters or a string. If set to null, then a GET request is used. 122 | * @param {Object} [headers] An associative array of name (header) value (header value) pairs 123 | * @param {string} [httpMethod] Specify the appropriate http method to use for your integration. 124 | * Supported http methods are HEAD, DELETE and PUT. This parameter allows for easier 125 | * integration with external RESTful services using the standard REST functions. 126 | * Note that if the httpMethod parameter is empty or not specified, this behavior is followed: 127 | * the method is POST if postdata is not empty. The method is GET if it is. 128 | * Be aware that the httpMethod parameter overrides, so you can specify GET and specify postdata, 129 | * NetSuite will do a GET and ignore the postdata. 130 | * 131 | * @return {nlobjResponse} 132 | * @since 2012.1 133 | */ 134 | function nlapiRequestURLWithCredentials(credentials, url, postdata, headers, httpMethod) { 135 | } 136 | 137 | /** 138 | * Sends a single on-demand campaign email to a specified recipient 139 | * and returns a campaign response ID to track the email 140 | * 141 | * @governance 10 units 142 | * @restriction works in conjunction with the Lead Nurturing (campaigndrip) sublist only 143 | * 144 | * @param {int} campaigneventid internal ID of the campaign event 145 | * @param {int} recipientid internal ID of the recipient - the recipient must have an email 146 | * 147 | * @return {int} 148 | * @since 2010.1 149 | */ 150 | function nlapiSendCampaignEmail(campaigneventid, recipientid) { 151 | } 152 | 153 | /** 154 | * Send out an email and associate it with records in the system 155 | * Supported base types are entity for entities, transaction for transactions, activity for activities and cases, 156 | * record|recordtype for custom records 157 | * 158 | * @governance 10 units 159 | * @restriction all outbound emails subject to email Anti-SPAM policies 160 | * 161 | * @param {int} from internal ID for employee user on behalf of whom this email is sent 162 | * @param {string, int} to email address or internal ID of user that this email is being sent to 163 | * @param {string} subject email subject 164 | * @param {string} body email body 165 | * @param {string, string[]} [cc] copy email address(es) 166 | * @param {string, string[]} [bcc] blind copy email address(es) 167 | * @param {Object} [records] Object of base types -> internal IDs used to associate email to records. i.e. 168 | * {entity: 100, record: 23, recordtype: customrecord_surveys} 169 | * @param {nlobjFile[]} [files] array of nlobjFile objects (files) to include as attachments 170 | * 171 | * @return {void} 172 | * 173 | * @exception {SSS_AUTHOR_MUST_BE_EMPLOYEE} 174 | * @exception {SSS_AUTHOR_REQD} 175 | * @exception {SSS_INVALID_RECIPIENT_ID} 176 | * @exception {SSS_MISSING_REQD_ARG} 177 | * @exception {SSS_RECIPIENT_REQD} 178 | * @exception {SSS_INVALID_CC_EMAIL} 179 | * @exception {SSS_INVALID_BCC_EMAIL} 180 | * @since 2007.0 181 | */ 182 | function nlapiSendEmail(from, to, subject, body, cc, bcc, records, files) { 183 | } 184 | 185 | /** 186 | * Send out a fax and associate it with records in the system. This requires fax preferences to be configured 187 | * Supported base types are entity for entities, transaction for transactions, activity for activities and cases, 188 | * record|recordtype for custom records 189 | * 190 | * @governance 10 units 191 | * 192 | * @param {int} from internal ID for employee user on behalf of whom this fax is sent 193 | * @param {string, int} to fax address or internal ID of user that this fax is being sent to 194 | * @param {string} subject fax subject 195 | * @param {string} [body] fax body 196 | * @param {Object} [records] Object of base types -> internal IDs used to associate fax to records. i.e. 197 | * {entity: 100, record: 23, recordtype: customrecord_surveys} 198 | * @param {nlobjFile[]} [files] array of nlobjFile objects (files) to include as attachments 199 | * @param {boolean} [internal] When a message record is set to internal only, customers do not see 200 | * the message from the customer center 201 | * @return {void} 202 | * @since 2008.2 203 | */ 204 | function nlapiSendFax(from, to, subject, body, records, files, internal) { 205 | } 206 | 207 | /** 208 | * Resolve a URL to a resource or object in the system 209 | * 210 | * This API is supported in client, user event, scheduled, portlet, and Suitelet scripts. 211 | * 212 | * @param {string} type type specifier for URL: suitelet|tasklink|record|mediaitem 213 | * @param {string} subtype subtype specifier for URL (corresponding to type): scriptid|taskid|recordtype|mediaid 214 | * @param {string} [id] internal ID specifier (sub-subtype corresponding to type): deploymentid|n/a|recordid|n/a 215 | * @param {string|boolean} [pageMode] string specifier used to configure page (suitelet: external|internal, tasklink|record: edit|view) 216 | * 217 | * @return {string} Depending on the values specified for the type and displayMode arguments, 218 | * returns URL string to an internal NetSuite resource or an external/internal URL to a Suitelet. 219 | * @exception {SSS_INVALID_URL_CATEGORY} 220 | * @exception {SSS_CATEGORY_ARG_REQD} 221 | * @exception {SSS_INVALID_TASK_ID} 222 | * @exception {SSS_TASK_ID_REQD} 223 | * @exception {SSS_INVALID_INTERNAL_ID} 224 | * @exception {SSS_INVALID_EDITMODE_ARG} 225 | * @since 2007.0 226 | */ 227 | function nlapiResolveURL(type, subtype, id, pageMode) { 228 | } 229 | 230 | /** 231 | * Redirect the user to a page. Only valid in the UI on Suitelets and User Events. In Client scripts this will initialize the redirect URL used upon submit 232 | * 233 | * @param {string} type type specifier for URL: suitelet|tasklink|record|mediaitem 234 | * @param {string} subtype subtype specifier for URL (corresponding to type): scriptid|taskid|recordtype|mediaid 235 | * @param {string} [id] internal ID specifier (sub-subtype corresponding to type): deploymentid|n/a|recordid|n/a 236 | * @param {string} [pageMode] string specifier used to configure page (suitelet: external|internal, tasklink|record: edit|view) 237 | * @param {Object} [parameters] Object used to specify additional URL parameters as name/value pairs 238 | * 239 | * @return {void} 240 | * @exception {SSS_INVALID_ARG} 241 | * @exception {SSS_INVALID_URL_CATEGORY} 242 | * @exception {SSS_CATEGORY_ARG_REQD} 243 | * @exception {SSS_INVALID_TASK_ID} 244 | * @exception {SSS_TASK_ID_REQD} 245 | * @exception {SSS_INVALID_INTERNAL_ID} 246 | * @exception {SSS_INVALID_EDITMODE_ARG} 247 | * @since 2007.0 248 | */ 249 | function nlapiSetRedirectURL(type, subtype, id, pageMode, parameters) { 250 | } 251 | 252 | /** 253 | * Primary object used to encapsulate an HTTP GET or POST request 254 | * 255 | * When creating Suitelets you will pass request and response arguments to your user-defined function. 256 | * With the request object instantiated, you can then call any nlobjRequest method. 257 | * 258 | * @constructor 259 | */ 260 | function nlobjRequest() { 261 | } 262 | 263 | /** 264 | * Return the value of a request parameter 265 | * 266 | * @param {string} name parameter name 267 | * 268 | * @return {string} 269 | * @since 2008.2 270 | */ 271 | nlobjRequest.prototype.getParameter = function(name) { 272 | }; 273 | 274 | /** 275 | * Return the values of a request parameter as an Array 276 | * 277 | * @param {string} name parameter name 278 | * 279 | * @return {string[]} 280 | * @since 2008.2 281 | */ 282 | nlobjRequest.prototype.getParameterValues = function(name) { 283 | }; 284 | 285 | /** 286 | * Return an Object containing all the request parameters and their values 287 | * 288 | * @return {Object} 289 | * @since 2008.2 290 | */ 291 | nlobjRequest.prototype.getAllParameters = function() { 292 | }; 293 | 294 | /** 295 | * Return the value of a sublist value 296 | * 297 | * @param {string} group sublist name 298 | * @param {string} name sublist field name 299 | * @param {int} line sublist line number 300 | * 301 | * @return {string} 302 | * @since 2008.2 303 | */ 304 | nlobjRequest.prototype.getLineItemValue = function(group, name, line) { 305 | }; 306 | 307 | /** 308 | * Return the number of lines in a sublist 309 | * 310 | * @param {string} group sublist name 311 | * 312 | * @return {int} 313 | * @since 2008.2 314 | */ 315 | nlobjRequest.prototype.getLineItemCount = function(group) { 316 | }; 317 | 318 | /** 319 | * Return the value of a request header 320 | * 321 | * @param {string} name 322 | * 323 | * @return {string} 324 | * @since 2008.2 325 | */ 326 | nlobjRequest.prototype.getHeader = function(name) { 327 | }; 328 | 329 | /** 330 | * Return an Object containing all the request headers and their values 331 | * 332 | * @return {Object} 333 | * @since 2008.2 334 | */ 335 | nlobjRequest.prototype.getAllHeaders = function() { 336 | }; 337 | 338 | /** 339 | * Return the value of an uploaded file 340 | * 341 | * Note: 10MB file size limit 342 | * 343 | * @param {string} name file field name 344 | * 345 | * @return {nlobjFile} 346 | * @since 2009.1 347 | */ 348 | nlobjRequest.prototype.getFile = function(name) { 349 | }; 350 | 351 | /** 352 | * Return an Object containing field names to file objects for all uploaded files 353 | * 354 | * @return {Object} 355 | * @since 2009.1 356 | */ 357 | nlobjRequest.prototype.getAllFiles = function() { 358 | }; 359 | 360 | /** 361 | * Return the body of the POST request 362 | * @return {string} 363 | * 364 | * @since 2008.1 365 | */ 366 | nlobjRequest.prototype.getBody = function() { 367 | }; 368 | 369 | /** 370 | * Return the URL of the request 371 | * 372 | * @return {string} 373 | * 374 | * @since 2008.1 375 | */ 376 | nlobjRequest.prototype.getURL = function() { 377 | }; 378 | 379 | /** 380 | * Return the METHOD of the request 381 | * 382 | * @return {string} 'GET' or 'POST' 383 | * @since 2008.1 384 | */ 385 | nlobjRequest.prototype.getMethod = function() { 386 | }; 387 | 388 | /** 389 | * Return a new instance of nlobjServerResponse. 390 | * 391 | * Contains the results of a server response to an outbound Http(s) call. 392 | * 393 | * @since 2008.1 394 | */ 395 | function nlobjServerResponse() { 396 | } 397 | 398 | /** 399 | * return the Content-Type header in response 400 | * 401 | * @return {string} 402 | * @since 2008.1 403 | */ 404 | nlobjServerResponse.prototype.getContentType = function() { 405 | }; 406 | 407 | /** 408 | * return the value of a header returned. 409 | * 410 | * @param {string} name the name of the header to return 411 | * @return {string|null} 412 | * @since 2008.1 413 | */ 414 | nlobjServerResponse.prototype.getHeader = function(name) { 415 | }; 416 | 417 | /** 418 | * return all the values of a header returned. 419 | * 420 | * @param {string} name the name of the header to return 421 | * @return {string[]|null} 422 | * @since 2008.1 423 | */ 424 | nlobjServerResponse.prototype.getHeaders = function(name) { 425 | }; 426 | 427 | /** 428 | * return an Array of all headers returned. 429 | * 430 | * @return {string[]} 431 | * @since 2008.1 432 | */ 433 | nlobjServerResponse.prototype.getAllHeaders = function() { 434 | }; 435 | 436 | /** 437 | * return the response code returned. 438 | * 439 | * @return {String} The HTTP response code int as a string 440 | * @since 2008.1 441 | */ 442 | nlobjServerResponse.prototype.getCode = function() { 443 | }; 444 | 445 | /** 446 | * return the response body returned. 447 | * 448 | * @return {string} 449 | * @since 2008.1 450 | */ 451 | nlobjServerResponse.prototype.getBody = function() { 452 | }; 453 | 454 | /** 455 | * return the nlobjError thrown via a client call to nlapiRequestURL. 456 | * 457 | * When nlapiRequestURL is used on the server side and an error occurs, it will 458 | * throw an error before returning. As expected. 459 | * 460 | * @return {nlobjError} 461 | * @since 2008.1 462 | */ 463 | nlobjServerResponse.prototype.getError = function() { 464 | }; 465 | 466 | /** 467 | * Accessor to Http response made available to Suitelets 468 | * Return a new instance of nlobjResponse used for scripting web responses in Suitelets 469 | * 470 | * @constructor 471 | */ 472 | function nlobjResponse() { 473 | } 474 | 475 | /** 476 | * Add a value for a response header 477 | * 478 | * @param {string} name of header 479 | * @param {string} value for header 480 | * 481 | * @return {void} 482 | * @since 2008.2 483 | */ 484 | nlobjResponse.prototype.addHeader = function(name, value) { 485 | }; 486 | 487 | /** 488 | * Set the value of a response header 489 | * 490 | * @param {string} name of header 491 | * @param {string} value for header 492 | * 493 | * @return {void} 494 | * @since 2008.2 495 | */ 496 | nlobjResponse.prototype.setHeader = function(name, value) { 497 | }; 498 | 499 | /** 500 | * Return the value of a response header 501 | * 502 | * @param {string} name 503 | * 504 | * @return {string} 505 | * @since 2008.2 506 | */ 507 | nlobjResponse.prototype.getHeader = function(name) { 508 | }; 509 | 510 | /** 511 | * Return an Array of all response header values for a header 512 | * 513 | * @param {string} name of header 514 | * 515 | * @return {string[]} 516 | * @since 2008.2 517 | */ 518 | nlobjResponse.prototype.getHeaders = function(name) { 519 | }; 520 | 521 | /** 522 | * Return an object of all response headers 523 | * 524 | * @return {Object} 525 | * @since 2008.2 526 | */ 527 | nlobjResponse.prototype.getAllHeaders = function() { 528 | }; 529 | 530 | /** 531 | * Returns the body returned by the server 532 | * 533 | * @return {string} 534 | * @since 2008.2 535 | */ 536 | nlobjResponse.prototype.getBody = function() { 537 | }; 538 | 539 | /** 540 | * Returns the response code returned by the server 541 | * 542 | * @return {string} 543 | * @since 2008.2 544 | */ 545 | nlobjResponse.prototype.getCode = function() { 546 | }; 547 | 548 | /** 549 | * Returns the nlobjError thrown during request. 550 | * Only available in the return value of call to nlapiRequestURL in Client SuiteScript. 551 | * 552 | * @return {nlobjError} 553 | * @since 2008.2 554 | */ 555 | nlobjResponse.prototype.getError = function() { 556 | }; 557 | 558 | /** 559 | * Suppress caching for this response 560 | * 561 | * @return {void} 562 | * @since 2009.1 563 | */ 564 | nlobjResponse.prototype.sendNoCache = function() { 565 | }; 566 | 567 | /** 568 | * Sets the content type for the response (and an optional filename for binary output) 569 | * 570 | * @param {string} type the file type i.e. plainText, word, pdf, htmldoc (see list of media item types) 571 | * @param {string} [filename] the file name 572 | * @param {string} [disposition] Content Disposition used for streaming attachments: inline|attachment 573 | * 574 | * @return {void} 575 | * @since 2008.2 576 | */ 577 | nlobjResponse.prototype.setContentType = function(type, filename, disposition) { 578 | }; 579 | 580 | /** 581 | * Sets the redirect URL for the response 582 | * 583 | * All URLs must be internal unless the Suitelet is being executed in an "Available without Login" context 584 | * at which point it can use type "external" to specify an external url via the subtype arg 585 | * 586 | * @param {string} type type specifier for URL: suitelet|tasklink|record|mediaitem|external 587 | * @param {string} subtype subtype specifier for URL (corresponding to type): scriptid|taskid|recordtype|mediaid|url 588 | * @param {string} [id] internal ID specifier (sub-subtype corresponding to type): deploymentid|n/a|recordid|n/a 589 | * @param {string} [pageMode] string specifier used to configure page (suitelet: external|internal, tasklink|record: edit|view) 590 | * @param {Object} [parameters] Object used to specify additional URL parameters as name/value pairs 591 | * 592 | * @return {void} 593 | * @since 2008.2 594 | */ 595 | nlobjResponse.prototype.sendRedirect = function(type, subtype, id, pageMode, parameters) { 596 | }; 597 | 598 | /** 599 | * Write information (text/xml/html/pdf) to the response 600 | * 601 | * @param {string|nlobjFile} output 602 | * @return {void} 603 | * @since 2008.2 604 | */ 605 | nlobjResponse.prototype.write = function(output) { 606 | }; 607 | 608 | /** 609 | * Write line information (text/xml/html) to the response 610 | * 611 | * @param {string} output 612 | * @return {void} 613 | * @since 2008.2 614 | */ 615 | nlobjResponse.prototype.writeLine = function(output) { 616 | }; 617 | 618 | /** 619 | * Write a UI object page 620 | * 621 | * @param {nlobjList|nlobjAssistant|nlobjForm} pageObject 622 | * 623 | * @return {void} 624 | * @since 2008.2 625 | */ 626 | nlobjResponse.prototype.writePage = function(pageObject) { 627 | }; 628 | 629 | /** 630 | * Sets the character encoding for the response 631 | * 632 | * @param {string} encoding 633 | * 634 | * @return {void} 635 | * @since 2012.2 636 | */ 637 | nlobjResponse.prototype.setEncoding = function(encoding) { 638 | }; 639 | 640 | /** 641 | * Generates a PDF directly to a response 642 | * 643 | * @restriction Server SuiteScript only 644 | * @governance 10 units 645 | * 646 | * @param {string} xmlString string containing BFO compliant XHTML 647 | * 648 | * @return {void} 649 | * @since 2014.2 650 | */ 651 | nlobjResponse.prototype.renderPDF = function(xmlString) { 652 | }; 653 | -------------------------------------------------------------------------------- /configuration.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SuiteScript Configuration APIs 3 | * 4 | * NetSuite allows developers to programmatically obtain, and in some cases, change the values 5 | * on certain account configuration pages. 6 | */ 7 | 8 | 9 | /** 10 | * Loads a configuration record 11 | * 12 | * The following configuration pages support SuiteScript: 13 | * Company Information, General Preferences, Accounting Preferences, Accounting Periods, Tax Periods. 14 | * Once a page is loaded, you can set configuration values using nlobjConfiguration.setFieldValue(name, value). 15 | * Available in scheduled and Suitelet scripts only. 16 | * 17 | * @governance 10 units 18 | * 19 | * @param {string} type The internal ID of the configuration page. Available IDs are: 20 | * • userpreferences - Home > Set Preferences. 21 | * • companyinformation - Setup > Company > Company Information 22 | * • companypreferences - Setup > Company > General Preferences 23 | * • accountingpreferences - Setup > Accounting > Accounting Preferences 24 | * • accountingperiods - Setup > Accounting > Manage Accounting Periods 25 | * • taxperiods - Setup > Accounting > Manage Tax Periods 26 | * • companyfeatures - The internal ID for looking up which features are enabled in an account. 27 | * 28 | * @return {nlobjConfiguration} 29 | * @since 2009.2 30 | */ 31 | function nlapiLoadConfiguration(type) { 32 | } 33 | 34 | /** 35 | * Commits all changes to a configuration record 36 | * 37 | * Available in scheduled and Suitelet scripts only 38 | * 39 | * @governance 20 units 40 | * 41 | * @param {nlobjConfiguration} config 42 | * 43 | * @return (void) 44 | * @since 2009.2 45 | */ 46 | function nlapiSubmitConfiguration(config) { 47 | } 48 | 49 | /** 50 | * Class definition for interacting with setup/configuration pages 51 | * 52 | * @constructor 53 | * @since 2009.2 54 | */ 55 | function nlobjConfiguration() { 56 | } 57 | 58 | /** 59 | * Return the type corresponding to this setup record 60 | * 61 | * @return {string} 62 | * @since 2009.2 63 | */ 64 | nlobjConfiguration.prototype.getType = function() { 65 | }; 66 | 67 | /** 68 | * Return field metadata for field 69 | * 70 | * @param {string} fieldName field name 71 | * 72 | * @return {nlobjField|null} 73 | * @since 2009.2 74 | */ 75 | nlobjConfiguration.prototype.getField = function(fieldName) { 76 | }; 77 | 78 | /** 79 | * Set the value of a field 80 | * 81 | * @param {string} name field name 82 | * @param {string} value field value 83 | * 84 | * @return {void} 85 | * @since 2009.2 86 | */ 87 | nlobjConfiguration.prototype.setFieldValue = function(name, value) { 88 | }; 89 | 90 | /** 91 | * Set the values of a multi-select field 92 | * @restriction only supported for multi-select fields 93 | * 94 | * @param {string} name field name 95 | * @param {string[]} value field values 96 | * 97 | * @return {void} 98 | * @since 2009.2 99 | */ 100 | nlobjConfiguration.prototype.setFieldValues = function(name, value) { 101 | }; 102 | 103 | /** 104 | * Return the value of a field 105 | * 106 | * @param {string} name field name 107 | * 108 | * @return {string} 109 | * @since 2009.2 110 | */ 111 | nlobjConfiguration.prototype.getFieldValue = function(name) { 112 | }; 113 | 114 | /** 115 | * Return the selected values of a multi-select field as an Array 116 | * @restriction only supported for multi-select fields 117 | * 118 | * @param {string} name field name 119 | * 120 | * @return {string[]} 121 | * @since 2009.2 122 | */ 123 | nlobjConfiguration.prototype.getFieldValues = function(name) { 124 | }; 125 | 126 | /** 127 | * Set the value (via display value) of a field 128 | * @restriction only supported for select fields 129 | * 130 | * @param {string} name field name 131 | * @param {string} text field display text 132 | * 133 | * @return {void} 134 | * @since 2009.2 135 | */ 136 | nlobjConfiguration.prototype.setFieldText = function(name, text) { 137 | }; 138 | 139 | /** 140 | * Set the values (via display values) of a multi-select field 141 | * @restriction only supported for multi-select fields 142 | * 143 | * @param {string} name field name 144 | * @param {string[]} texts array of field display text values 145 | * 146 | * @return {void} 147 | * @since 2009.2 148 | */ 149 | nlobjConfiguration.prototype.setFieldTexts = function(name, texts) { 150 | }; 151 | 152 | /** 153 | * Return the text value of a field 154 | * @restriction only supported for select fields 155 | * 156 | * @param {string} name field name 157 | * @return {string} 158 | * 159 | * @since 2009.2 160 | */ 161 | nlobjConfiguration.prototype.getFieldText = function(name) { 162 | }; 163 | 164 | /** 165 | * Return the selected text values of a multi-select field as an Array 166 | * 167 | * @param {string} name field name 168 | * 169 | * @return {string[]} 170 | * @since 2009.2 171 | */ 172 | nlobjConfiguration.prototype.getFieldTexts = function(name) { 173 | }; 174 | 175 | /** 176 | * Return an Array of all field names on the record 177 | * 178 | * @return {string[]} 179 | * @since 2009.2 180 | */ 181 | nlobjConfiguration.prototype.getAllFields = function() { 182 | }; 183 | -------------------------------------------------------------------------------- /currency.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SuiteScript Currency APIs 3 | * 4 | * Use these APIs to work with currency, as it pertains to your NetSuite account 5 | */ 6 | 7 | 8 | /** 9 | * Calculate exchange rate between two currencies as of today or an optional effective date 10 | * 11 | * This API is supported in client, user event, scheduled, portlet, and Suitelet scripts 12 | * 13 | * @governance 10 units 14 | * 15 | * @param {string, int} fromCurrency internal ID or currency code of currency we are converting from 16 | * @param {string, int} toCurrency internal ID or currency code of currency we are converting to 17 | * @param {string} [date] string containing date of effective exchange rate. defaults to today 18 | * 19 | * @return {number} The exchange rate (as a float) in the same precision that is displayed in the NetSuite UI. 20 | * Note that null is returned if the targetCurrency is not set to a base currency. 21 | * @exception {SSS_INVALID_CURRENCY_ID} If an invalid currency (from or to) is specified 22 | * @since 2009.1 23 | */ 24 | function nlapiExchangeRate(fromCurrency, toCurrency, date) { 25 | } 26 | 27 | /** 28 | * Format a number for data entry into a currency field 29 | * 30 | * @param {string} string numeric string used to format for display as currency using user's locale 31 | * 32 | * @return {string} 33 | * @since 2008.1 34 | */ 35 | function nlapiFormatCurrency(string) { 36 | } 37 | -------------------------------------------------------------------------------- /date.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SuiteScript Date APIs 3 | * 4 | * Use these APIs to manipulate standard JavaScript Date and String objects 5 | */ 6 | 7 | 8 | /** 9 | * Convert a String into a Date object 10 | * 11 | * @param {string} str date string in the user's date format, timeofday format, or datetime format 12 | * @param {string} [format='date'] format type to use: date|datetime|timeofday 13 | * 14 | * @return {Date} 15 | * @since 2005.0 16 | */ 17 | function nlapiStringToDate(str, format) { 18 | } 19 | 20 | /** 21 | * Convert a Date object into a formatted String 22 | * 23 | * @param {Date} date date object being converted to a string 24 | * @param {string} [format='date'] format type to use: date|datetime|timeofday 25 | * 26 | * @return {string} 27 | * @since 2005.0 28 | */ 29 | function nlapiDateToString(date, format) { 30 | } 31 | 32 | /** 33 | * Add/subtract days to a Date object and returns a new Date 34 | * 35 | * @param {Date} date date object used to calculate the new date 36 | * @param {int} days the number of days to add to this date object 37 | * 38 | * @return {Date} 39 | * @since 2008.1 40 | */ 41 | function nlapiAddDays(date, days) { 42 | } 43 | 44 | /** 45 | * Add/subtract months to a Date object and returns a new Date 46 | * 47 | * @param {Date} date date object used to calculate the new date 48 | * @param {int} months the number of months to add to this date object 49 | * 50 | * @return {Date} 51 | * @since 2008.1 52 | */ 53 | function nlapiAddMonths(date, months) { 54 | } 55 | -------------------------------------------------------------------------------- /encryption.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SuiteScript Encryption APIs 3 | */ 4 | 5 | /** 6 | * Encrypt a string using a SHA1 hash function 7 | * 8 | * This function is available on the client side by making a server request. 9 | * 10 | * @param {string} string string to encrypt 11 | * @param {string} [algorithm=sha] sha1 - hash, aes - encrypt, base64 - Base 64 encode, xor - Exclusive-OR obfuscation 12 | * @param {string} [key] 128-bit, 192-bit, or 256-bit hex key for AES 13 | * 14 | * @return {string} 15 | * @since 2009.2 16 | */ 17 | function nlapiEncrypt(string, algorithm, key) { 18 | } 19 | -------------------------------------------------------------------------------- /error.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SuiteScript Error Handling APIs 3 | */ 4 | 5 | 6 | /** 7 | * Create an nlobjError object that can be used to abort script execution and configure error notification 8 | * This API is supported in user event, scheduled, portlet, and Suitelet scripts. 9 | * 10 | * @param {string} code error code 11 | * @param {string} details error description 12 | * @param {boolean} [suppressEmail=false] if true then suppress the error notification emails from being sent out 13 | * 14 | * @return {nlobjError} 15 | * @since 2008.2 16 | */ 17 | function nlapiCreateError(code, details, suppressEmail) { 18 | } 19 | 20 | /** 21 | * Encapsulation of errors thrown during script execution 22 | * Return a new instance of nlobjError used system or user-defined error object 23 | * 24 | * @constructor 25 | */ 26 | function nlobjError() { 27 | } 28 | 29 | /** 30 | * Return the error db ID for this error (if it was an unhandled unexpected error) 31 | * 32 | * @return {string} 33 | * @since 2008.2 34 | */ 35 | nlobjError.prototype.getId = function() { 36 | }; 37 | 38 | /** 39 | * Return the error code for this system or user-defined error 40 | * 41 | * @return {string} 42 | * @since 2008.2 43 | */ 44 | nlobjError.prototype.getCode = function() { 45 | }; 46 | 47 | /** 48 | * Return the error description for this error 49 | * 50 | * @return {string} 51 | * @since 2008.2 52 | */ 53 | nlobjError.prototype.getDetails = function() { 54 | }; 55 | 56 | /** 57 | * Return a stacktrace containing the location of the error 58 | * 59 | * @return {string[]} 60 | * @since 2008.2 61 | */ 62 | nlobjError.prototype.getStackTrace = function() { 63 | }; 64 | 65 | /** 66 | * Return the userevent script name where this error was thrown 67 | * 68 | * @return {string} 69 | * @since 2008.2 70 | */ 71 | nlobjError.prototype.getUserEvent = function() { 72 | }; 73 | 74 | /** 75 | * Return the internalid of the record if this error was thrown in an aftersubmit script 76 | * 77 | * @return {int} 78 | * @since 2008.2 79 | */ 80 | nlobjError.prototype.getInternalId = function() { 81 | }; 82 | -------------------------------------------------------------------------------- /executionContext.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SuiteScript Execution Context APIs 3 | * 4 | * Context APIs are used to get system information or metadata about a script that is running, 5 | * a user in a NetSuite account, or certain settings that have been applied to account. 6 | */ 7 | 8 | 9 | /** 10 | * Return context information about the current user/script 11 | * 12 | * @return {nlobjContext} 13 | * @since 2007.0 14 | */ 15 | function nlapiGetContext() { 16 | } 17 | 18 | /** 19 | * Return the internal ID for the currently logged in user. 20 | * Returns -4 when called from online forms or "Available without Login" Suitelets 21 | * 22 | * @return {int} 23 | * @since 2005.0 24 | */ 25 | function nlapiGetUser() { 26 | } 27 | 28 | /** 29 | * Return the internal ID for the current user's role. 30 | * Returns 31 (Online Form User) when called from online forms or "Available without Login" Suitelets 31 | * 32 | * @return {int} 33 | * @since 2005.0 34 | */ 35 | function nlapiGetRole() { 36 | } 37 | 38 | /** 39 | * Return the internal ID for the current user's department 40 | * 41 | * @return {int} 42 | * @since 2005.0 43 | */ 44 | function nlapiGetDepartment() { 45 | } 46 | 47 | /** 48 | * Return the internal ID for the current user's location 49 | * 50 | * @return {int} 51 | * @since 2005.0 52 | */ 53 | function nlapiGetLocation() { 54 | } 55 | 56 | /** 57 | * Return the internal ID for the current user's subsidiary 58 | * 59 | * @return {int} 60 | * @since 2008.1 61 | */ 62 | function nlapiGetSubsidiary() { 63 | } 64 | 65 | /** 66 | * Create an entry in the script execution log (note that execution log entries are automatically purged after 30 days) 67 | * 68 | * @param {string} type One of the following log types: 69 | * • DEBUG 70 | * • AUDIT 71 | * • ERROR 72 | * • EMERGENCY 73 | * @param {string} title log title (up to 90 characters supported) 74 | * @param {string} [details] log details (up to 3000 characters supported) 75 | * 76 | * @return {void} 77 | * @since 2008.1 78 | */ 79 | function nlapiLogExecution(type, title, details) { 80 | } 81 | 82 | /** 83 | * Utility class providing information about the current user and the script runtime 84 | * Return a new instance of nlobjContext used for user and script context information 85 | * 86 | * @constructor 87 | */ 88 | function nlobjContext() { 89 | } 90 | 91 | /** 92 | * Return the name of the current user 93 | * 94 | * @return {string} 95 | * @since 2007.0 96 | */ 97 | nlobjContext.prototype.getName = function() { 98 | }; 99 | 100 | /** 101 | * Return the internalId of the current user 102 | * 103 | * @return {string} 104 | * @since 2007.0 105 | */ 106 | nlobjContext.prototype.getUser = function() { 107 | }; 108 | 109 | /** 110 | * Return the internalId of the current user's role 111 | * 112 | * @return {string} 113 | * @since 2007.0 114 | */ 115 | nlobjContext.prototype.getRole = function() { 116 | }; 117 | 118 | /** 119 | * Return the script ID of the current user's role 120 | * 121 | * @return {string} 122 | * @since 2008.2 123 | */ 124 | nlobjContext.prototype.getRoleId = function() { 125 | }; 126 | 127 | /** 128 | * Return the internalId of the current user's center type 129 | * 130 | * @return {string} 131 | * @since 2008.2 132 | */ 133 | nlobjContext.prototype.getRoleCenter = function() { 134 | }; 135 | 136 | /** 137 | * Return the email address of the current user 138 | * 139 | * @return {string} 140 | * @since 2007.0 141 | */ 142 | nlobjContext.prototype.getEmail = function() { 143 | }; 144 | 145 | /** 146 | * Return the internal ID of the contact logged in on behalf of a customer, vendor, or partner 147 | * It returns -1 for non-contact logins 148 | * 149 | * @return {int} 150 | * @since 2009.1 151 | */ 152 | nlobjContext.prototype.getContact = function() { 153 | }; 154 | 155 | /** 156 | * Return the account ID of the current user 157 | * 158 | * @return {string} 159 | * @since 2007.0 160 | */ 161 | nlobjContext.prototype.getCompany = function() { 162 | }; 163 | 164 | /** 165 | * Return the internalId of the current user's department 166 | * 167 | * @return {int} 168 | * @since 2007.0 169 | */ 170 | nlobjContext.prototype.getDepartment = function() { 171 | }; 172 | 173 | /** 174 | * Return the internalId of the current user's location 175 | * 176 | * @return {int} 177 | * @since 2007.0 178 | */ 179 | nlobjContext.prototype.getLocation = function() { 180 | }; 181 | 182 | /** 183 | * Return the internalId of the current user's subsidiary 184 | * 185 | * @return {int} 186 | * @since 2007.0 187 | */ 188 | nlobjContext.prototype.getSubsidiary = function() { 189 | }; 190 | 191 | /** 192 | * Return the execution context for this script, one of: 193 | * • userinterface - Client SuiteScript or user event triggers invoked from the UI 194 | * • webservices - User event triggers invoked from webservice calls 195 | * • csvimport - User event triggers invoked during CSV imports 196 | * • smbxml - User event triggers invoked during SMBXML calls 197 | * • portlet - Portlet script or user event triggers invoked via portlet scripts 198 | * • scheduled - Scheduled script or user event triggers invoked via scheduled scripts 199 | * • suitelet - Suitelet or user event triggers invoked via suitelets 200 | * • custommassupdate - Mass update script triggers invoked via custom Mass Update scripts 201 | * • workflow - Workflow action script triggers invoked via Workflow Action scripts 202 | * • webstore - User event triggers invoked from the web store (for example to determine if sales 203 | * orders or customers were created in the web store). 204 | * • userevent - This context type represents cases in which records are generated in the backend 205 | * (as opposed to being generated by the UI). For example, the 'userevent' context 206 | * distinguishes the case wherein a Bill Payment is submitted as part of a non- record page. 207 | * Whereas the 'userinterface' context identifies when a single Bill Payement record 208 | * is submitted from the UI. 209 | * 210 | * @return {string} 211 | * @since 2007.0 212 | */ 213 | nlobjContext.prototype.getExecutionContext = function() { 214 | }; 215 | 216 | /** 217 | * Return the amount of usage units remaining for this script 218 | * 219 | * @return {int} 220 | * @since 2007.0 221 | */ 222 | nlobjContext.prototype.getRemainingUsage = function() { 223 | }; 224 | 225 | /** 226 | * Return true if feature is enabled, false otherwise 227 | * 228 | * @param {string} name 229 | * 230 | * @return {boolean} Returns true if a feature is enabled in the current account 231 | * @since 2009.2 232 | */ 233 | nlobjContext.prototype.getFeature = function(name) { 234 | }; 235 | 236 | /** 237 | * Return current user's permission level (0-4) for this permission 238 | * 239 | * @param {string} name 240 | * 241 | * @return {int} 242 | * @since 2009.2 243 | */ 244 | nlobjContext.prototype.getPermission = function(name) { 245 | }; 246 | 247 | /** 248 | * Return system or script preference selection for current user 249 | * 250 | * @param {string} name 251 | * 252 | * @return {string} 253 | * @since 2009.2 254 | */ 255 | nlobjContext.prototype.getPreference = function(name) { 256 | }; 257 | 258 | /** 259 | * Return value of session object set by script 260 | * 261 | * @param {string} name 262 | * 263 | * @return {string} 264 | * @since 2009.2 265 | */ 266 | nlobjContext.prototype.getSessionObject = function(name) { 267 | }; 268 | 269 | /** 270 | * Set the value of a session object using a key 271 | * 272 | * @param {string} name 273 | * @param {string} value 274 | * 275 | * @return {void} 276 | * @since 2009.2 277 | */ 278 | nlobjContext.prototype.setSessionObject = function(name, value) { 279 | }; 280 | 281 | /** 282 | * Return an array containing the names of all keys used to set session objects 283 | * 284 | * @return {string[]} 285 | * @since 2009.2 286 | */ 287 | nlobjContext.prototype.getAllSessionObjects = function() { 288 | }; 289 | 290 | /** 291 | * Return the NetSuite version for the current account 292 | * 293 | * @return {string} 294 | * @since 2009.2 295 | */ 296 | nlobjContext.prototype.getVersion = function() { 297 | }; 298 | 299 | /** 300 | * @return {string} The environment that the script is executing in: SANDBOX, PRODUCTION, BETA, INTERNAL 301 | * @since 2008.2 302 | */ 303 | nlobjContext.prototype.getEnvironment = function() { 304 | }; 305 | 306 | /** 307 | * Return the logging level for the current script execution. Not supported in CLIENT scripts 308 | * 309 | * @return {string} 310 | * @since 2008.2 311 | */ 312 | nlobjContext.prototype.getLogLevel = function() { 313 | }; 314 | 315 | /** 316 | * Return the script ID for the current script 317 | * 318 | * @return {string} 319 | * @since 2009.2 320 | */ 321 | nlobjContext.prototype.getScriptId = function() { 322 | }; 323 | 324 | /** 325 | * Return the deployment ID for the current script 326 | * 327 | * @return {string} 328 | * @since 2009.2 329 | */ 330 | nlobjContext.prototype.getDeploymentId = function() { 331 | }; 332 | 333 | /** 334 | * Return the % complete specified for the current scheduled script execution 335 | * 336 | * @return {int} 337 | * @since 2009.2 338 | */ 339 | nlobjContext.prototype.getPercentComplete = function() { 340 | }; 341 | 342 | /** 343 | * Set the % complete for the current scheduled script execution 344 | * 345 | * @param {number} percent the percentage of records completed 346 | * @return {void} 347 | * @since 2009.2 348 | */ 349 | nlobjContext.prototype.setPercentComplete = function(percent) { 350 | }; 351 | 352 | /** 353 | * Return a system/script setting. Types are SCRIPT, SESSION, FEATURE, PERMISSION 354 | * 355 | * Note that if you want to get session, feature, or permission settings directly, 356 | * this method should be considered deprecated, use getFeature(), getPermission() or getSessionObject instead 357 | * 358 | * @param {string} type 359 | * @param {string} name 360 | * 361 | * @return {string|int} If type is specified as SCRIPT, SESSION, or FEATURE, a string value is returned 362 | * If type is specified as PERMISSION, an integer value is returned 363 | * @since 2007.0 364 | * @see getFeature 365 | * @see getPermission 366 | * @see getSessionObject 367 | */ 368 | nlobjContext.prototype.getSetting = function(type, name) { 369 | }; 370 | 371 | /** 372 | * Set a system/script setting. Only supported type is SESSION 373 | * 374 | * @param {string} type 375 | * @param {string} name 376 | * @param {string} value 377 | * 378 | * @return {void} 379 | * @since 2007.0 380 | * @see setSessionObject 381 | * @deprecated Use setSessionObject() instead 382 | */ 383 | nlobjContext.prototype.setSetting = function(type, name, value) { 384 | }; 385 | 386 | /** 387 | * Return an Object containing name/value pairs of color groups to their corresponding 388 | * RGB hex color based on the currently logged in user's color them preferences. 389 | * 390 | * Note: NetSuite color themes are read-only. 391 | * 392 | * The following table provides the names of available NetSuite color theme attributes 393 | * and a description of what each attribute affects. 394 | * 395 | * Attribute Description 396 | * -----------------------|--------------------------------------------------------------------- 397 | * buttonbackground Background color of colored buttons 398 | * text Text color for all text on the page body 399 | * portlet Portlet trim (header background) color 400 | * portletlabel Text in portlet heading 401 | * crumbtext Text color of breadcrumbs on the header bar (color may be synthesized by page looks) 402 | * inactivetab Inactive tab color 403 | * link Text color for all links on the page bodySuiteScript Objects 404 | * backgroundrequiredfld Background color for required fields in entry forms 405 | * inactivetextontab Text color on the inactive tab 406 | * textontab Text color on the active tab 407 | * bodybackground Page background color 408 | * headbackground Page header area background color 409 | * shadedbackground Shaded area background color 410 | * headerbar Header bar color 411 | * shadedborder Border/header color around shaded areas 412 | * activetab Active tab color 413 | * 414 | * @return {Object} 415 | * @since 2010.1 416 | * @deprecated 2014.2 417 | */ 418 | nlobjContext.prototype.getColorPreferences = function() { 419 | }; 420 | 421 | /** 422 | * Return the runtime version of SuiteScript, could be 1.0 or 2.0 423 | * 424 | * @return {Object} 425 | * @since 2014.1 426 | */ 427 | nlobjContext.prototype.getRuntimeVersion = function() { 428 | }; 429 | -------------------------------------------------------------------------------- /field.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SuiteScript Field APIs 3 | * 4 | * The SuiteScript API includes several Field APIs you can use to set and get values for built-in NetSuite standard 5 | * fields, as well as for custom fields. 6 | * 7 | * Standard fields are those that come with NetSuite. 8 | * 9 | * Custom fields are those that have been created by NetSuite users to customize their accounts. 10 | * Custom fields are created using SuiteBuilder point-and-click customization tools. 11 | */ 12 | 13 | /** 14 | * Sets the given field to disabled or enabled based on the value (true or false) 15 | * 16 | * This API is supported in client scripts only. 17 | * 18 | * @param {string} fieldName The internal ID name of the field to enable/disable 19 | * @param {boolean} value If set to true the field is disabled. If set to false it is enabled 20 | * 21 | * @return {void} 22 | */ 23 | function nlapiDisableField(fieldName, value) { 24 | } 25 | 26 | /** 27 | * Return field definition for a field 28 | * 29 | * @param {string} fieldName the name of the field 30 | * 31 | * @return {nlobjField} 32 | * @since 2009.1 33 | */ 34 | function nlapiGetField(fieldName) { 35 | } 36 | 37 | /** 38 | * Return field mandatoriness 39 | * 40 | * @param {string} fieldName field name 41 | * 42 | * @return {boolean} 43 | * @since 2009.1 44 | */ 45 | function nlapiGetFieldMandatory(fieldName) { 46 | } 47 | 48 | /** 49 | * Return the display value of a select field's current selection on the current record on a page 50 | * 51 | * @restriction supported in client and user event scripts only 52 | * 53 | * @param {string} fieldName the field name 54 | * 55 | * @return {string} 56 | * @since 2005.0 57 | */ 58 | function nlapiGetFieldText(fieldName) { 59 | } 60 | 61 | /** 62 | * Return the values (via display text) of a multiselect field on the current record 63 | * 64 | * @restriction supported in client and user event scripts only 65 | * 66 | * @param {string} fieldName field name 67 | * 68 | * @return {string[]} 69 | * @since 2009.1 70 | */ 71 | function nlapiGetFieldTexts(fieldName) { 72 | } 73 | 74 | /** 75 | * Return the value of a field on the current record on a page 76 | * 77 | * @restriction supported in client and user event scripts only 78 | * 79 | * @param {string} fieldName the field name 80 | * 81 | * @return {string} 82 | * @since 2005.0 83 | */ 84 | function nlapiGetFieldValue(fieldName) { 85 | } 86 | 87 | /** 88 | * Return the values of a multiselect field on the current record on a page 89 | * 90 | * @restriction supported in client and user event scripts only 91 | * 92 | * @param {string} fieldName the field name 93 | * 94 | * @return {string[]} 95 | * @since 2005.0 96 | */ 97 | function nlapiGetFieldValues(fieldName) { 98 | } 99 | 100 | /** 101 | * Adds a select option to a scripted select or multiselect field 102 | * 103 | * @restriction Client SuiteScript only 104 | * 105 | * @param {string} fieldName field name 106 | * @param {string} value internal ID for select option 107 | * @param {string} text display text for select option 108 | * @param {boolean} [selected] if true then option will be selected by default 109 | * 110 | * @return {void} 111 | * @since 2008.2 112 | */ 113 | function nlapiInsertSelectOption(fieldName, value, text, selected) { 114 | } 115 | 116 | /** 117 | * Performs a search for one or more body fields on a record 118 | * 119 | * This function supports joined-field lookups. Note that the notation for joined fields is: join_id.field_name 120 | * 121 | * Note: Long text fields are truncated at 4000 characters in search/lookup operations 122 | * This API is available in client, user event, scheduled, portlet, and Suitelet scripts. 123 | * 124 | * @governance 10 units for transactions, 2 for custom records, 5 for all other records 125 | * 126 | * @param {string} type The record internal ID name 127 | * @param {int} id The internalId for the record, for example 777 or 87 128 | * @param {string|string[]} fields Sets an array of column/field names to look up, or a single column/field name. 129 | * The fields parameter can also be set to reference joined fields 130 | * @param {boolean} [text=false] If false the internal ID of the drop-down field is returned. 131 | * If set to true, this argument returns the UI display name for this field or fields 132 | * (valid only for SELECT|IMAGE|DOCUMENT fields) 133 | * 134 | * @return {string|Object} A single value (or text) or an associative Array of field name -> value (or text) pairs 135 | * depending on the field’s argument. 136 | */ 137 | function nlapiLookupField(type, id, fields, text) { 138 | } 139 | 140 | /** 141 | * Removes a select option (or all if value is null) from a scripted select or multiselect field 142 | * 143 | * @restriction Client SuiteScript only 144 | * 145 | * @param {string} fieldName field name 146 | * @param {string} value internal ID of select option to remove 147 | * 148 | * @return {void} 149 | * @since 2008.2 150 | */ 151 | function nlapiRemoveSelectOption(fieldName, value) { 152 | } 153 | 154 | /** 155 | * Make a field mandatory 156 | * 157 | * @param {string} fieldName field name 158 | * @param {boolean} mandatory if true then field is made mandatory 159 | * 160 | * @return {void} 161 | * @since 2009.1 162 | */ 163 | function nlapiSetFieldMandatory(fieldName, mandatory) { 164 | } 165 | 166 | /** 167 | * Set the value of a field on the current record on a page using it's label 168 | * @restriction synchronous arg is only supported in client SuiteScript 169 | * 170 | * @param {string} fieldName the field name 171 | * @param {string} txt display name used to lookup field value 172 | * @param {boolean} [fireFieldChanged=true] if false then the field change event is suppressed 173 | * @param {boolean} [synchronous=false] if true then sourcing and field change execution happens synchronously 174 | * 175 | * @return {void} 176 | * @since 2005.0 177 | */ 178 | function nlapiSetFieldText(fieldName, txt, fireFieldChanged, synchronous) { 179 | } 180 | 181 | /** 182 | * Set the values (via display text) of a multiselect field on the current record on a page 183 | * 184 | * @restriction supported in client and user event scripts only 185 | * @restriction synchronous arg is only supported in client SuiteScript 186 | * 187 | * @param {string} fieldName field name 188 | * @param {string[]} texts array of strings containing display values for field 189 | * @param {boolean} [fireFieldChanged=true] if false then the field change event is suppressed 190 | * @param {boolean} [synchronous=false] if true then sourcing and field change execution happens synchronously 191 | * 192 | * @return {void} 193 | * @since 2009.1 194 | */ 195 | function nlapiSetFieldTexts(fieldName, texts, fireFieldChanged, synchronous) { 196 | } 197 | 198 | /** 199 | * Set the value of a field on the current record on a page 200 | * @restriction supported in client and user event scripts only 201 | * @restriction synchronous arg is only supported in client SuiteScript 202 | * 203 | * @param {string} fieldName the field name 204 | * @param {string} value value used to set field 205 | * @param {boolean} [fireFieldChanged=true] if false then the field change event is suppressed 206 | * @param {boolean} [synchronous=false] if true then sourcing and field change execution happens synchronously 207 | * 208 | * @return {void} 209 | * @since 2005.0 210 | */ 211 | function nlapiSetFieldValue(fieldName, value, fireFieldChanged, synchronous) { 212 | } 213 | 214 | /** 215 | * Set the values of a multiselect field on the current record on a page 216 | * 217 | * @restriction supported in client and user event scripts only 218 | * @restriction synchronous arg is only supported in client SuiteScript 219 | * 220 | * @param {string} fieldName field name 221 | * @param {string[]} values array of strings containing values for field 222 | * @param {boolean} [fireFieldChanged=true] if false then the field change event is suppressed 223 | * @param {boolean} [synchronous=false] if true then sourcing and field change execution happens synchronously 224 | * 225 | * @return {void} 226 | * @since 2005.0 227 | */ 228 | function nlapiSetFieldValues(fieldName, values, fireFieldChanged, synchronous) { 229 | } 230 | 231 | /** 232 | * Submit the values of a field or set of fields for an existing record 233 | * 234 | * @governance 10 units for transactions, 2 for custom records, 4 for all other records 235 | * @restriction only supported for records and fields where DLE (Direct List Editing) is supported 236 | * 237 | * @param {string} type The record type name 238 | * @param {int} id The internal ID for the record 239 | * @param {string, string[]} fields field or fields being updated 240 | * @param {string, string[]} values field value or field values used for updating 241 | * @param {boolean} [doSourcing=false] If not set, this argument defaults to false and field sourcing does not occur 242 | * @return {void} 243 | * @since 2008.1 244 | */ 245 | function nlapiSubmitField(type, id, fields, values, doSourcing) { 246 | } 247 | 248 | /** 249 | * Core descriptor for fields used to define records and also used to build pages and portlets 250 | * 251 | * This object is READ-ONLY except for scripted fields created via the UI Object API using Suitelets 252 | * or beforeLoad user events 253 | * 254 | * Important Things to Note about nlobjField: 255 | * • To add a nlobjField object to an existing NetSuite form (that appears on a record), 256 | * use a beforeLoad user event script. 257 | * 258 | * • To add a nlobjField object to a Suitelet, you must create a custom form using nlapiCreateForm(title, hideNavbar), 259 | * which returns an nlobjForm object. Once the form object is instantiated, add a new field to the form using 260 | * the nlobjForm.addField(name, type, label, sourceOrRadio, tab) method, which returns a reference to nlobjField. 261 | * 262 | * • To return a reference to an nlobjField object, use nlapiGetField(fieldName) (for body fields) or 263 | * nlapiGetLineItemField(type, fieldName, linenum) (for sublist fields). If you do not know the difference 264 | * between a body field and a sublist field, see Working with Fields Overview in the NetSuite Help Center. 265 | * 266 | * • If you use nlapiGetField(fieldName) in a client script to return a nlobjField object, the object returned 267 | * is read-only. This means that you can use nlobjField getter methods on the object, however, you cannot 268 | * use nlobjField setter methods to set field properties. 269 | * 270 | * • Be aware of any special permissions that might be applied to a field. For example, a permission error will 271 | * be thrown if you attempt to get select options on a field that has been disabled on a form. 272 | * 273 | * @constructor 274 | */ 275 | function nlobjField() { 276 | } 277 | 278 | /** 279 | * Return field name 280 | * @return {string} 281 | * @since 2009.2 282 | */ 283 | nlobjField.prototype.getName = function() { 284 | }; 285 | 286 | /** 287 | * Return field label 288 | * @return {string} 289 | * @since 2009.2 290 | */ 291 | nlobjField.prototype.getLabel = function() { 292 | }; 293 | 294 | /** 295 | * Return field type 296 | * @return {string} 297 | * @since 2009.2 298 | */ 299 | nlobjField.prototype.getType = function() { 300 | }; 301 | 302 | /** 303 | * Return true if field is hidden 304 | * @return {boolean} 305 | * @since 2009.2 306 | */ 307 | nlobjField.prototype.isHidden = function() { 308 | }; 309 | 310 | /** 311 | * Return true if field is mandatory 312 | * @return {boolean} 313 | * @since 2009.2 314 | */ 315 | nlobjField.prototype.isMandatory = function() { 316 | }; 317 | 318 | /** 319 | * Return true if field is disabled 320 | * @return {boolean} 321 | * @since 2009.2 322 | */ 323 | nlobjField.prototype.isDisabled = function() { 324 | }; 325 | 326 | /** 327 | * Set the label for this field 328 | * This method is only supported on scripted fields via the UI Object API 329 | * 330 | * @param {string} label 331 | * @return {nlobjField} 332 | * @since 2008.2 333 | */ 334 | nlobjField.prototype.setLabel = function(label) { 335 | }; 336 | 337 | /** 338 | * Set the alias used to set the value for this field. Defaults to field name 339 | * This method is only supported on scripted fields via the UI Object API 340 | * 341 | * @param {string} alias column used to populate the field (mostly relevant when populating sublist fields) 342 | * @return {nlobjField} 343 | * @since 2008.2 344 | */ 345 | nlobjField.prototype.setAlias = function(alias) { 346 | }; 347 | 348 | /** 349 | * Set the default value for this field 350 | * This method is only supported on scripted fields via the UI Object API 351 | * 352 | * @param {string} value 353 | * @return {nlobjField} 354 | * @since 2008.2 355 | */ 356 | nlobjField.prototype.setDefaultValue = function(value) { 357 | }; 358 | 359 | /** 360 | * Disable field via field metadata 361 | * This method is only supported on scripted fields via the UI Object API 362 | * @param {boolean} disabled if true then field should be disabled 363 | * @return {nlobjField} 364 | * @since 2009.2 365 | */ 366 | nlobjField.prototype.setDisabled = function(disabled) { 367 | }; 368 | 369 | /** 370 | * Make this field mandatory 371 | * This method is only supported on scripted fields via the UI Object API 372 | * 373 | * @param {boolean} mandatory if true then field becomes mandatory 374 | * @return {nlobjField} 375 | * @since 2008.2 376 | */ 377 | nlobjField.prototype.setMandatory = function(mandatory) { 378 | }; 379 | 380 | /** 381 | * Set the max-length for this field (only valid for certain field types) 382 | * This method is only supported on scripted fields via the UI Object API 383 | * 384 | * @param {int} maxLength maximum length for this field 385 | * @return {nlobjField} 386 | * @since 2008.2 387 | */ 388 | nlobjField.prototype.setMaxLength = function(maxLength) { 389 | }; 390 | 391 | /** 392 | * Set the display type for this field 393 | * 394 | * @param {string} type • hidden – Hides the field on the form. 395 | * • inline – Not supported in client side scripts. 396 | * • readonly – Disables the field. The field is still selectable and 397 | * scrollable. Supported with textarea fields and rich text fields. 398 | * • entry – Makes a sublist field appear as a data entry input field. 399 | * Supported with non-checkbox select fields. 400 | * • disabled - Disables the field from the users' changes. 401 | * • normal - Makes the field appear as normal input field. 402 | * Supported with non-sublist fields. 403 | * @return {nlobjField} 404 | * @since 2008.2 405 | */ 406 | nlobjField.prototype.setDisplayType = function(type) { 407 | }; 408 | 409 | /** 410 | * Set the break type (startcol|startrow|none) for this field. 411 | * startrow is only used for fields with a layout typeof outside 412 | * This method is only supported on scripted fields via the UI Object API 413 | * 414 | * @param {string} breaktype break type used to add a break in flow layout for this field: startcol|startrow|none 415 | * @return {nlobjField} 416 | * @since 2009.2 417 | */ 418 | nlobjField.prototype.setBreakType = function(breaktype) { 419 | }; 420 | 421 | /** 422 | * Set the layout type and optionally the break type 423 | * This method is only supported on scripted fields via the UI Object API 424 | * 425 | * @param {string} type layout type: outside|startrow|midrow|endrow|normal 426 | * @param {string} [breakType] break type: startcol|startrow|none 427 | * @return {nlobjField} 428 | * @since 2008.2 429 | */ 430 | nlobjField.prototype.setLayoutType = function(type, breakType) { 431 | }; 432 | 433 | /** 434 | * Set the text that gets displayed in lieu of the field value for URL fields 435 | * 436 | * @param {string} text user-friendly display value in lieu of URL 437 | * @return {nlobjField} 438 | * @since 2008.2 439 | */ 440 | nlobjField.prototype.setLinkText = function(text) { 441 | }; 442 | 443 | /** 444 | * Set the width and height for this field 445 | * This method is only supported on scripted fields via the UI Object API 446 | * 447 | * @param {int} width 448 | * @param {int} height 449 | * @return {nlobjField} 450 | * @since 2008.2 451 | */ 452 | nlobjField.prototype.setDisplaySize = function(width, height) { 453 | }; 454 | 455 | /** 456 | * Set the amount of empty vertical space (rows) between this field and the previous field 457 | * This method is only supported on scripted fields via the UI Object API 458 | * 459 | * @param {int} padding # of empty rows to display above field 460 | * @return {nlobjField} 461 | * @since 2008.2 462 | */ 463 | nlobjField.prototype.setPadding = function(padding) { 464 | }; 465 | 466 | /** 467 | * Set help text for this field. If inline is set on assistant pages, help is displayed inline below field 468 | * This method is only supported on scripted fields via the UI Object API 469 | * 470 | * @param {string} help field level help content (rich text) for field 471 | * @param {string} [inline] if true then in addition to the popup field help, the help will also be displayed 472 | * inline below field (supported on assistant pages only) 473 | * @return {nlobjField} 474 | * @since 2009.2 475 | */ 476 | nlobjField.prototype.setHelpText = function(help, inline) { 477 | }; 478 | 479 | /** 480 | * Add a select option to this field (valid for select/multiselect fields) 481 | * This method is only supported on scripted fields via the UI Object API 482 | * 483 | * @param {string} value internal ID for this select option 484 | * @param {string} text display value for this select option 485 | * @param {boolean} [selected] if true then this select option will be selected by default 486 | * @since 2008.2 487 | */ 488 | nlobjField.prototype.addSelectOption = function(value, text, selected) { 489 | }; 490 | 491 | /** 492 | * Use this API to obtain a list of available options on a select field 493 | * 494 | * This API can be used on both standard and custom select fields. Only the first 1,000 available 495 | * options will be returned by this API. 496 | * This method can only be used in server contexts against a record object. Also note that a call to this 497 | * method may return different results for the same field for different roles. 498 | * If you attempt to get select options on a field that is not a select field, or if you reference a field 499 | * that does not exist on the form, null is returned. 500 | * 501 | * @param {string} [filter] A search string to filter the select options that are returned. 502 | * For example, if there are 50 select options available, and 10 of the options 503 | * contains 'John', e.g. “John Smith” or “Shauna Johnson”, only those 10 options will be returned. 504 | * 505 | * Note: Filter values are case insensitive. 506 | * The filters 'John' and 'john' will return the same select options. 507 | * @param {string} [filterOperator='contains'] Supported operators are contains | is | startswith. 508 | * If not specified, defaults to the contains operator. 509 | * 510 | * @return {nlobjSelectOption} 511 | * @since 2009.2 512 | */ 513 | nlobjField.prototype.getSelectOptions = function(filter, filterOperator) { 514 | }; 515 | 516 | /** 517 | * Select|radio option used for building select fields via the UI Object API and for describing select|radio fields 518 | * 519 | * @constructor 520 | * @since 2009.2 521 | */ 522 | function nlobjSelectOption() { 523 | } 524 | 525 | /** 526 | * Return internal ID for select option 527 | * 528 | * @return {string} 529 | * @since 2009.2 530 | */ 531 | nlobjSelectOption.prototype.getId = function() { 532 | }; 533 | 534 | /** 535 | * Return display value for select option 536 | * 537 | * @return {string} 538 | * @since 2009.2 539 | */ 540 | nlobjSelectOption.prototype.getText = function() { 541 | }; 542 | -------------------------------------------------------------------------------- /file.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SuiteScript File APIs 3 | * 4 | * Use these APIs to work with files that currently exist in the NetSuite file cabinet. 5 | * These APIs can also be used to create files to load into NetSuite or to send as attachments in email. 6 | * 7 | * File Type ID Name Extension Content Type 8 | * --------------|-------------------|-----------|---------------------------------- 9 | * AUTOCAD AutoCad .dwg application/x-autocad 10 | * BMPIMAGE BMP Image .bmp image/x-xbitmap 11 | * CSV CSV File .csv text/csv 12 | * EXCEL Excel File .xls application/vnd.ms-excel 13 | * FLASH Flash Animation .swf application/x-shockwave-flash 14 | * GIFIMAGE GIF Image .gif image/gif 15 | * GZIP GNU Zip File .gz application/x-gzip-compressed 16 | * HTMLDOC HTML File .htm text/html 17 | * ICON Icon Image .ico image/ico 18 | * JAVASCRIPT JavaScript File .js text/javascript 19 | * JPGIMAGE JPEG Image .jpg image/jpeg 20 | * MESSAGERFC Message RFC .eml message/rfc822 21 | * MP3 MP3 Audio .mp3 audio/mpeg 22 | * MPEGMOVIE MPEG Video .mpg video/mpeg 23 | * MSPROJECT Project File .mpp application/vnd.ms-project 24 | * PDF PDF File .pdf application/pdf 25 | * PJPGIMAGE PJPEG Image .pjpeg image/pjpeg 26 | * PLAINTEXT Plain Text File .txt text/plain 27 | * PNGIMAGE PNG Image .png image/x-png 28 | * POSTSCRIPT PostScript File .ps application/postscript 29 | * POWERPOINT PowerPoint File .ppt application/vnd.ms-powerpoint 30 | * QUICKTIME QuickTime Video .mov video/quicktime 31 | * RTF RTF File .rtf application/rtf 32 | * SMS SMS File .sms application/sms 33 | * STYLESHEET CSS File .css text/css 34 | * TIFFIMAGE TIFF Image .tiff image/tiff 35 | * VISIO Visio File .vsd application/vnd.visio 36 | * WORD Word File .doc application/msword 37 | * XMLDOC XML File .xml text/xml 38 | * ZIP Zip File .zip application/zip 39 | */ 40 | 41 | 42 | /** 43 | * Instantiate a file object (specifying the name, type, and contents which are base-64 encoded for binary types.) 44 | * 45 | * Note: There is a 5MB limitation to the size of the document that can be created using this API. 46 | * 47 | * @restriction Server SuiteScript only 48 | * 49 | * @param {string} name file name 50 | * @param {string} type file type i.e. plainText, htmlDoc, pdf, word (see documentation for the list of supported file types) 51 | * @param {string} contents string containing file contents (must be base-64 encoded for binary types) 52 | * 53 | * @return {nlobjFile} 54 | * @since 2009.1 55 | */ 56 | function nlapiCreateFile(name, type, contents) { 57 | } 58 | 59 | /** 60 | * Delete a file from the file cabinet 61 | * @governance 20 units 62 | * @restriction Server SuiteScript only 63 | * 64 | * @param {int} id The internal ID of file to be deleted 65 | * @return {int} id The internal ID for the file that was deleted 66 | * @since 2009.1 67 | */ 68 | function nlapiDeleteFile(id) { 69 | } 70 | 71 | /** 72 | * Load a file from the file cabinet (via its internal ID or path) 73 | * @governance 10 units 74 | * @restriction Server SuiteScript only 75 | * 76 | * Note if an ID is passed in that ID is at least 8 characters, it must be cast to a string 77 | * or an UNEXPECTED_ERROR is thrown. Support Case #: 1947546 78 | * 79 | * @param {string, int} id internal ID or relative path to file in the file cabinet (i.e. SuiteScripts/foo.js) 80 | * @return {nlobjFile} 81 | * @since 2008.2 82 | */ 83 | function nlapiLoadFile(id) { 84 | } 85 | 86 | /** 87 | * Add/update a file in the file cabinet 88 | * @governance 20 units 89 | * @restriction Server SuiteScript only 90 | * 91 | * @param {nlobjFile} file a file object to submit 92 | * @return {int} return internal ID of file 93 | * @since 2009.1 94 | */ 95 | function nlapiSubmitFile(file) { 96 | } 97 | 98 | /** 99 | * Encapsulation of files (media items) in the file cabinet 100 | * Return a new instance of nlobjFile used for accessing and manipulating files in the file cabinet 101 | * 102 | * @constructor 103 | * @since 2009.1 104 | */ 105 | function nlobjFile() { 106 | } 107 | 108 | /** 109 | * Return the name of the file 110 | * 111 | * @return {string} 112 | * @since 2009.1 113 | */ 114 | nlobjFile.prototype.getName = function() { 115 | }; 116 | 117 | /** 118 | * Sets the name of a file 119 | * 120 | * @param {string} name the name of the file 121 | * 122 | * @return {void} 123 | * @since 2009.1 124 | */ 125 | nlobjFile.prototype.setName = function(name) { 126 | }; 127 | 128 | /** 129 | * Return the internal ID of the folder that this file is in 130 | * 131 | * @return {int} 132 | * @since 2009.1 133 | */ 134 | nlobjFile.prototype.getFolder = function() { 135 | }; 136 | 137 | /** 138 | * Sets the internal ID of the folder that this file is in 139 | * 140 | * @param {int} folder 141 | * 142 | * @return {void} 143 | * @since 2009.1 144 | */ 145 | nlobjFile.prototype.setFolder = function(folder) { 146 | }; 147 | 148 | /** 149 | * Sets the character encoding for the file 150 | * 151 | * @param {string} encoding 152 | * 153 | * @return {void} 154 | * @since 2010.2 155 | */ 156 | nlobjFile.prototype.setEncoding = function(encoding) { 157 | }; 158 | 159 | /** 160 | * Return true if the file is "Available without Login" 161 | * 162 | * @return {boolean} 163 | * @since 2009.1 164 | */ 165 | nlobjFile.prototype.isOnline = function() { 166 | }; 167 | 168 | /** 169 | * Sets the file's "Available without Login" status 170 | * 171 | * 172 | * @param {boolean} online 173 | * @return {void} 174 | * @since 2009.1 175 | */ 176 | nlobjFile.prototype.setIsOnline = function(online) { 177 | }; 178 | 179 | /** 180 | * Return true if the file is inactive 181 | * 182 | * @return {boolean} 183 | * @since 2009.1 184 | */ 185 | nlobjFile.prototype.isInactive = function() { 186 | }; 187 | 188 | /** 189 | * Sets the file's inactive status 190 | * 191 | * @param {boolean} inactive 192 | * @return {void} 193 | * @since 2009.1 194 | */ 195 | nlobjFile.prototype.setIsInactive = function(inactive) { 196 | }; 197 | 198 | /** 199 | * Return the file description 200 | * 201 | * @return {string} 202 | * @since 2009.1 203 | */ 204 | nlobjFile.prototype.getDescription = function() { 205 | }; 206 | 207 | /** 208 | * Sets the file's description 209 | * @param {string} desc the file description 210 | * 211 | * @return {void} 212 | * @since 2009.1 213 | */ 214 | nlobjFile.prototype.setDescription = function(desc) { 215 | }; 216 | 217 | /** 218 | * Return the id of the file (if stored in the FC) 219 | * 220 | * @return {int} 221 | * @since 2009.1 222 | */ 223 | nlobjFile.prototype.getId = function() { 224 | }; 225 | 226 | /** 227 | * Return the size of the file in bytes 228 | * 229 | * @return {int} 230 | * @since 2009.1 231 | */ 232 | nlobjFile.prototype.getSize = function() { 233 | }; 234 | 235 | /** 236 | * Return the URL of the file (if stored in the FC) 237 | * 238 | * @return {string} 239 | * @since 2009.1 240 | */ 241 | nlobjFile.prototype.getURL = function() { 242 | }; 243 | 244 | /** 245 | * Return the type of the file 246 | * 247 | * @return {string} 248 | * @since 2009.1 249 | */ 250 | nlobjFile.prototype.getType = function() { 251 | }; 252 | 253 | /** 254 | * Return the value (base64 encoded for binary types) of the file 255 | * 256 | * @return {string} 257 | * @since 2009.1 258 | */ 259 | nlobjFile.prototype.getValue = function() { 260 | }; 261 | -------------------------------------------------------------------------------- /jobManager.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SuiteScript Job Manager APIs 3 | * 4 | * Use these APIs to send jobs to NetSuite's internal job manager. Currently the job manager that is exposed to 5 | * SuiteScript is the job manager that manages merging duplicate records. 6 | * 7 | * When submitting a “merge duplicate record” job to NetSuite, SuiteScript allows you to use all of the same 8 | * functionality available through the UI. Using SuiteScript you can use NetSuite's predefined duplicate detection 9 | * rules, or you can define your own. Note that the merge duplicate API runs in server scripts, such as user event 10 | * scripts, Suitelets, and RESTLets. You cannot write client scripts using this API. 11 | * 12 | * Important: The merge duplicate functionality of non-entity records is not supported in SuiteScript. 13 | * 14 | * Once your records are merged/deleted, these records no longer appear as duplicates accessible through 15 | * nlapiSearchDuplicate() or the UI (by going to Lists > Mass Update > Mass Duplicate Record Merge. 16 | * 17 | * Finally, be aware that when you submit a merge duplicate job, the maximum number of records you can submit in 18 | * your request is 200. Also be aware that then you call nlobjJobManager.submit() to submit your job request, 19 | * you are charged 100 governance units. 20 | */ 21 | 22 | 23 | /** 24 | * Returns a job manager instance 25 | * 26 | * You then use the methods on nlobjJobManager to create and submit your merge duplicate records request. 27 | * This API is supported in script types that run on the server. You cannot use this function in a client script. 28 | * 29 | * @governance 0 units 30 | * 31 | * @param {string} jobType Job Type 32 | * 33 | * @return {nlobjJobManager} 34 | * @since 2013.1 35 | */ 36 | function nlapiGetJobManager(jobType) { 37 | } 38 | 39 | /** 40 | * Encapsulates the properties of a job manager. 41 | * A call to nlapiGetJobManager(jobType) returns a reference to this object. Use the methods in nlobjJobManager 42 | * to create and submit your merge duplicate records job request. 43 | * 44 | * Important: When submitting a “merge duplicates” job, the maximum size of your job can be 200 record. 45 | * 46 | * @constructor 47 | */ 48 | function nlobjJobManager() { 49 | } 50 | 51 | /** 52 | * @return {nlobjDuplicateJobRequest} 53 | * @since 2013.1 54 | */ 55 | nlobjJobManager.prototype.createJobRequest = function() { 56 | }; 57 | 58 | /** 59 | * Use to submit your job request. 60 | * 61 | * When submitting a “merge duplicates” job, the maximum size of your job can be 200 record. 62 | * 63 | * Be aware that submitting a job places the job into the NetSuite work queue for processing. 64 | * Submitting a job does not mean that the job is executed right away 65 | * 66 | * @param {nlobjDuplicateJobRequest} request Job request 67 | * 68 | * @return {string} Job Id 69 | * @since 2013.1 70 | */ 71 | nlobjJobManager.prototype.submit = function(request) { 72 | }; 73 | 74 | /** 75 | * Then use the methods on the nlobFuture object to check the status of the job 76 | * 77 | * @governance 5 units 78 | * 79 | * @param {string} id Job Id 80 | * 81 | * @return {nlobjFuture} 82 | * @since 2013.1 83 | */ 84 | nlobjJobManager.prototype.getFuture = function(id) { 85 | }; 86 | 87 | /** 88 | * Primary object used to encapsulate all the properties of a merge duplicate record job request. 89 | * 90 | * Note that nlobjJobManager.createJobRequest() returns a reference to this object. 91 | * 92 | * Use the methods in nlobjDuplicateJobRequest to define the criteria of your merge duplicate request. 93 | * @constructor 94 | */ 95 | function nlobjDuplicateJobRequest() { 96 | } 97 | 98 | /** 99 | * Constant for Merge Duplicate records Entity Types 100 | * @since 2013.1 101 | */ 102 | nlobjDuplicateJobRequest.prototype.ENTITY_CUSTOMER = 'CUSTOMER'; 103 | nlobjDuplicateJobRequest.prototype.ENTITY_CONTACT = 'CONTACT'; 104 | nlobjDuplicateJobRequest.prototype.ENTITY_LEAD = 'LEAD'; 105 | nlobjDuplicateJobRequest.prototype.ENTITY_PROSPECT = 'PROSPECT'; 106 | nlobjDuplicateJobRequest.prototype.ENTITY_PARTNER = 'PARTNER'; 107 | nlobjDuplicateJobRequest.prototype.ENTITY_VENDOR = 'VENDOR'; 108 | 109 | /** 110 | * Constant for Merge Duplicate records Merge MASTERSELECTIONMODE 111 | * @since 2013.1 112 | */ 113 | nlobjDuplicateJobRequest.prototype.MASTERSELECTIONMODE_CREATED_EARLIEST = 'CREATED_EARLIEST'; 114 | nlobjDuplicateJobRequest.prototype.MASTERSELECTIONMODE_MOST_RECENT_ACTIVITY = 'MOST_RECENT_ACTIVITY'; 115 | nlobjDuplicateJobRequest.prototype.MASTERSELECTIONMODE_MOST_POPULATED_FIELDS = 'MOST_POPULATED_FIELDS'; 116 | nlobjDuplicateJobRequest.prototype.MASTERSELECTIONMODE_SELECT_BY_ID = 'SELECT_BY_ID'; 117 | 118 | /** 119 | * Constant for Merge Duplicate records Merge operation 120 | * @since 2013.1 121 | */ 122 | nlobjDuplicateJobRequest.prototype.OPERATION_MERGE = 'MERGE'; 123 | nlobjDuplicateJobRequest.prototype.OPERATION_DELETE = 'DELETE'; 124 | nlobjDuplicateJobRequest.prototype.OPERATION_MAKE_MASTER_PARENT = 'MAKE_MASTER_PARENT'; 125 | nlobjDuplicateJobRequest.prototype.OPERATION_MARK_AS_NOT_DUPES = 'MARK_AS_NOT_DUPES'; 126 | 127 | /** 128 | * @param {string} entityType Entity Type 129 | * @return {void} 130 | * @since 2013.1 131 | */ 132 | nlobjDuplicateJobRequest.prototype.setEntityType = function(entityType) { 133 | }; 134 | 135 | /** 136 | * @param {string} masterID Master record ID 137 | * @return {void} 138 | * @since 2013.1 139 | */ 140 | nlobjDuplicateJobRequest.prototype.setMasterId = function(masterID) { 141 | }; 142 | 143 | /** 144 | * @param {string} masterSelectionMode Criteria 145 | * @return {void} 146 | * @since 2013.1 147 | */ 148 | nlobjDuplicateJobRequest.prototype.setMasterSelectionMode = function(masterSelectionMode) { 149 | }; 150 | 151 | /** 152 | * @param {string[]} dupeRecords Array of duplicate records IDs 153 | * @return {void} 154 | * @since 2013.1 155 | */ 156 | nlobjDuplicateJobRequest.prototype.setRecords = function(dupeRecords) { 157 | }; 158 | 159 | /** 160 | * @param {string} operation 161 | * @return {void} 162 | * @since 2013.1 163 | */ 164 | nlobjDuplicateJobRequest.prototype.setOperation = function(operation) { 165 | }; 166 | 167 | /** 168 | * @return Entity Type 169 | * @since 2013.1 170 | */ 171 | nlobjDuplicateJobRequest.prototype.getEntityType = function() { 172 | }; 173 | 174 | /** 175 | * @return Master record ID 176 | * @since 2013.1 177 | */ 178 | nlobjDuplicateJobRequest.prototype.getMasterId = function() { 179 | }; 180 | 181 | /** 182 | * @return Master Selection Mode 183 | * @since 2013.1 184 | */ 185 | nlobjDuplicateJobRequest.prototype.getMasterSelectionMode = function() { 186 | }; 187 | 188 | /** 189 | * @return Array of duplicate records IDs 190 | * @since 2013.1 191 | */ 192 | nlobjDuplicateJobRequest.prototype.getRecords = function() { 193 | }; 194 | 195 | /** 196 | * @return Operation 197 | * @since 2013.1 198 | */ 199 | nlobjDuplicateJobRequest.prototype.getOperation = function() { 200 | }; 201 | 202 | /** 203 | * Encapsulates the properties of a merge duplicate record job status 204 | * 205 | * @constructor 206 | */ 207 | function nlobjFuture() { 208 | } 209 | 210 | /** 211 | * @return {boolean} status 212 | * @since 2013.1 213 | */ 214 | nlobjFuture.prototype.isDone = function() { 215 | }; 216 | 217 | /** 218 | * @return {string} Job ID 219 | * @since 2013.1 220 | */ 221 | nlobjFuture.prototype.getId = function() { 222 | }; 223 | 224 | /** 225 | * @return {boolean} is cancelled or not 226 | * @since 2013.1 227 | */ 228 | nlobjFuture.prototype.isCancelled = function() { 229 | }; 230 | -------------------------------------------------------------------------------- /portlet.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SuiteScript Portlet APIs 3 | */ 4 | 5 | 6 | /** 7 | * Causes a FORM type nlobjPortlet to immediately reload. 8 | * This API is available within a client SuiteScript associated with a custom FORM portlet, 9 | * or from JavaScript event handlers attached to portlet elements. 10 | * 11 | * This API cannot be called directly from within a FORM portlet script. 12 | * 13 | * @return {void} 14 | * @since 2011.1 15 | */ 16 | function nlapiRefreshPortlet() { 17 | } 18 | 19 | /** 20 | * Causes a FORM type nlobjPortlet to be resized. 21 | * 22 | * This API can be used to ensure that a custom form portlet’s embedded iframe resizes when the size 23 | * of its contents change. This type of iframe does not resize automatically as its contents change, 24 | * so when a form portlet’s contents shrink they are surrounded by white space, and when contents grow 25 | * they are cut off. A call to this API prevents these display issues. 26 | * 27 | * This API is available within a client SuiteScript associated with a custom FORM portlet, 28 | * or from JavaScript event handlers attached to portlet elements. This API cannot be called directly 29 | * from within a FORM portlet script. 30 | * 31 | * @return {void} 32 | * @since 2011.1 33 | */ 34 | function nlapiResizePortlet() { 35 | } 36 | -------------------------------------------------------------------------------- /record.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SuiteScript Record APIs 3 | * 4 | * When you work with Record APIs, you are doing things such as creating, deleting, copying, 5 | * or loading all elements of a record. 6 | * 7 | * Whether you are working with standard NetSuite records (for example, Sale Order, Invoice, Customer, Vendor) 8 | * or custom records you have created using SuiteBuilder, you will use all the same Record APIs 9 | * to interact with the record object. 10 | */ 11 | 12 | 13 | /** 14 | * Attach a single record to another with optional properties 15 | * 16 | * @governance 10 units 17 | * 18 | * @param {string} type1 The record type name being attached 19 | * @param {int} id1 The internal ID for the record being attached 20 | * @param {string} type2 The record type name being attached to 21 | * @param {int} id2 The internal ID for the record being attached to 22 | * @param {Object} [properties] Object containing name/value pairs used to configure attach operation 23 | * 24 | * @return {void} 25 | * @since 2008.2 26 | */ 27 | function nlapiAttachRecord(type1, id1, type2, id2, properties) { 28 | } 29 | 30 | /** 31 | * Return a new record using values from an existing record 32 | * @governance 10 units for transactions, 2 for custom records, 5 for all other records 33 | * 34 | * @param {string} type The record type name 35 | * @param {int} id The internal ID for the record 36 | * @param {Object} [initializeValues] Contains an array of name/value pairs of defaults to be used during record initialization 37 | * 38 | * @return {nlobjRecord} Returns an nlobjRecord object of a copied record 39 | * @since 2007.0 40 | */ 41 | function nlapiCopyRecord(type, id, initializeValues) { 42 | } 43 | 44 | /** 45 | * Initializes a new record and returns an nlobjCSVImport object. 46 | * 47 | * You can then use the methods available on the returned record object to populate the object with the desired 48 | * information. Next, you can pass this object to nlapiSubmitCSVImport(nlobjCSVImport), which asynchronously 49 | * imports the data from the returned object into NetSuite. 50 | * 51 | * Note that this API cannot be used to import data that is imported by simple (2-step) assistants in the UI, 52 | * because these import types do not support saved import maps. This limitation applies to budget, single journal 53 | * entry, single inventory worksheet, project tasks, and Web site redirects imports. 54 | * 55 | * Warning: This API is only supported for bundle installation scripts, scheduled scripts, and RESTlets. 56 | * If you attempt to execute this API in another type of script, an error is returned. 57 | * 58 | * @return {nlobjCSVImport} 59 | * @since 2012.2 60 | */ 61 | function nlapiCreateCSVImport() { 62 | } 63 | 64 | /** 65 | * Instantiate a new nlobjRecord object containing all the default field data for that record type 66 | * 67 | * @governance 10 units for transactions, 2 for custom records, 5 for all other records 68 | * 69 | * @param {string} type record type ID 70 | * @param {Object} [initialValues] Contains an array of name/value pairs of defaults to be used during record initialization 71 | * 72 | * @return {nlobjRecord} A new record from the system 73 | * @exception {SSS_INVALID_RECORD_TYPE} 74 | * @exception {SSS_TYPE_ARG_REQD} 75 | * @since 2007.0 76 | */ 77 | function nlapiCreateRecord(type, initialValues) { 78 | } 79 | 80 | /** 81 | * Delete a record from the system 82 | * 83 | * Warning: Use caution when using the nlapiDeleteRecord function in SuiteScript. 84 | * Records deleted using nlapiDeleteRecord are permanently deleted from the NetSuite database. 85 | * 86 | * @governance 20 units for transactions, 4 for custom records, 10 for all other records 87 | * 88 | * @param {string} type The record type name 89 | * @param {int} id The internal ID for the record 90 | * 91 | * @return {void} 92 | * 93 | * @exception {SSS_INVALID_RECORD_TYPE} 94 | * @exception {SSS_TYPE_ARG_REQD} 95 | * @exception {SSS_INVALID_INTERNAL_ID} 96 | * @exception {SSS_ID_ARG_REQD} 97 | * @since 2007.0 98 | */ 99 | function nlapiDeleteRecord(type, id) { 100 | } 101 | 102 | /** 103 | * Detach a single record from another with optional properties 104 | * @governance 10 units 105 | * 106 | * @param {string} type1 The record type name being attached 107 | * @param {int} id1 The internal ID for the record being attached 108 | * @param {string} type2 The record type name being attached to 109 | * @param {int} id2 The internal ID for the record being attached to 110 | * @param {Object} [properties] Object containing name/value pairs used to configure detach operation 111 | * 112 | * @return {void} 113 | * @since 2008.2 114 | */ 115 | function nlapiDetachRecord(type1, id1, type2, id2, properties) { 116 | } 117 | 118 | /** 119 | * Return an record object containing the data being submitted to the system for the currenr record 120 | * 121 | * @restriction User Event scripts only 122 | * 123 | * @return {nlobjRecord} 124 | * @since 2008.1 125 | */ 126 | function nlapiGetNewRecord() { 127 | } 128 | 129 | /** 130 | * Return an record object containing the current record's data prior to the write operation 131 | * @restriction beforeSubmit|afterSubmit User Event scripts only 132 | * 133 | * @return {nlobjRecord} 134 | * @since 2008.1 135 | */ 136 | function nlapiGetOldRecord() { 137 | } 138 | 139 | /** 140 | * Return the internal ID corresponding to the current page or userevent script 141 | * 142 | * @return {string} a string of digits 143 | * @since 2007.0 144 | */ 145 | function nlapiGetRecordId() { 146 | } 147 | 148 | /** 149 | * Return the recordtype corresponding to the current page or userevent script 150 | * 151 | * @return {string} 152 | * @since 2007.0 153 | */ 154 | function nlapiGetRecordType() { 155 | } 156 | 157 | /** 158 | * Load an existing record from the system 159 | * @governance 10 units for transactions, 2 for custom records, 5 for all other records 160 | * 161 | * @param {string} type The record type name 162 | * @param {int} id The internal ID for the record 163 | * @param {Object} [initializeValues] Contains an array of name/value pairs of defaults to be used during record initialization 164 | * 165 | * @return {nlobjRecord} Returns an nlobjRecord object of an existing NetSuite record 166 | * 167 | * @exception {SSS_INVALID_RECORD_TYPE} 168 | * @exception {SSS_TYPE_ARG_REQD} 169 | * @exception {SSS_INVALID_INTERNAL_ID} 170 | * @exception {SSS_ID_ARG_REQD} 171 | * @since 2007.0 172 | */ 173 | function nlapiLoadRecord(type, id, initializeValues) { 174 | } 175 | 176 | /** 177 | * Perform a mail merge operation using any template and up to 2 records and returns an nlobjFile with the results 178 | * 179 | * @restriction only supported for record types that are available in mail merge: transactions, entities, custom records, and cases 180 | * @restriction Server SuiteScript only 181 | * @governance 10 units 182 | * 183 | * @param {int} id internal ID of template 184 | * @param {string} baseType primary record type 185 | * @param {int} baseId internal ID of primary record 186 | * @param {string} [altType] secondary record type 187 | * @param {int} [altId] internal ID of secondary record 188 | * @param {Object} [fields] Object of merge field values to use in the mail merge 189 | * (by default all field values are obtained from records) which overrides those from the record 190 | * 191 | * @return {nlobjFile} 192 | * @since 2008.2 193 | */ 194 | function nlapiMergeRecord(id, baseType, baseId, altType, altId, fields) { 195 | } 196 | 197 | /** 198 | * Submits a CSV import job to asynchronously import record data into NetSuite. This API can be used to: 199 | * • Automate standard record data import for SuiteApp installations, demo environments, and testing environments. 200 | * • Import data on a schedule using a scheduled script. 201 | * • Build integrated CSV imports with RESTlets. 202 | * 203 | * When the API is executed, the import job is added to the queue. 204 | * The progress of an import job can be viewed at Setup > Import/Export > View CSV Import Status. 205 | * 206 | * Note that this API cannot be used to import data that is imported by simple (2-step) assistants in the UI, 207 | * because these import types do not support saved import maps. This limitation applies to budget, single 208 | * journal entry, single inventory worksheet, project tasks, and Web site redirects imports. 209 | * 210 | * This API is only supported for bundle installation scripts, scheduled scripts, and RESTlets. 211 | * If you attempt to execute this API in another type of script, an error is returned. 212 | * 213 | * @governance 100 units 214 | * 215 | * @param {nlobjCSVImport} nlobjCSVImport 216 | * 217 | * @return {string} job ID 218 | * @since 2012.2 219 | */ 220 | function nlapiSubmitCSVImport(nlobjCSVImport) { 221 | } 222 | 223 | /** 224 | * Submit a record to the system for creation or update 225 | * 226 | * @governance 20 units for transactions, 4 for custom records, 10 for all other records 227 | * 228 | * @param {nlobjRecord} record nlobjRecord object containing the data record 229 | * @param {boolean} [doSourcing=false] If not set, this argument defaults to false 230 | * @param {boolean} [ignoreMandatoryFields] Disables mandatory field validation for this submit operation 231 | * 232 | * @return {string} Internal ID for committed record 233 | * 234 | * @exception {SSS_INVALID_RECORD_OBJ} 235 | * @exception {SSS_RECORD_OBJ_REQD} 236 | * @exception {SSS_INVALID_SOURCE_ARG} 237 | * @since 2007.0 238 | */ 239 | function nlapiSubmitRecord(record, doSourcing, ignoreMandatoryFields) { 240 | } 241 | 242 | /** 243 | * Create a new record using values from an existing record of a different type 244 | * @governance 10 units for transactions, 2 for custom records, 4 for all other records 245 | * 246 | * @param {string} type The type of the existing record 247 | * @param {int} id The internal ID for the existing record 248 | * @param {string} transformType The expected record type of the new object 249 | * @param {Object} [transformValues] An object containing transform default option/value 250 | * pairs used to pre-configure transformed record 251 | * 252 | * @return {nlobjRecord} 253 | * 254 | * @exception {SSS_INVALID_URL_CATEGORY} 255 | * @exception {SSS_CATEGORY_ARG_REQD} 256 | * @exception {SSS_INVALID_TASK_ID} 257 | * @exception {SSS_TASK_ID_REQD} 258 | * @exception {SSS_INVALID_INTERNAL_ID} 259 | * @exception {SSS_INVALID_EDITMODE_ARG} 260 | * @since 2007.0 261 | */ 262 | function nlapiTransformRecord(type, id, transformType, transformValues) { 263 | } 264 | 265 | /** 266 | * Print a record (transaction) given its type, id, and output format 267 | * 268 | * @restriction Server SuiteScript only 269 | * @governance 10 units 270 | * 271 | * @param {string} type print output type: transaction|statement|packingslip|pickingticket 272 | * @param {int} id internal ID of record to print 273 | * @param {string} [format] output format: html|pdf|default 274 | * @param {Object} [properties] Object of properties used to configure print 275 | * @return {nlobjFile} 276 | * @since 2008.2 277 | */ 278 | function nlapiPrintRecord(type, id, format, properties) { 279 | } 280 | 281 | /** 282 | * Primary object used to encapsulate a CSV import job. 283 | * This object is passed as a parameter by nlapiSubmitCSVImport(nlobjCSVImport), which is used 284 | * to asynchronously import record data into NetSuite. 285 | * 286 | * Use nlapiCreateCSVImport( ) to return an nlobjCSVImport object. 287 | * You can then use the object’s methods to populate it with the desired information. 288 | * 289 | * Warning: You should execute setMapping(savedImport) before any of the other methods. 290 | * If you try to first execute setPrimaryFile(file), an error is returned. 291 | * 292 | * @constructor 293 | */ 294 | function nlobjCSVImport() { 295 | } 296 | 297 | /** 298 | * Sets the data to be imported in a linked file for a multi-file import job, by referencing a file 299 | * in the file cabinet using nlapiLoadFile, or by inputting CSV data as raw string. 300 | * 301 | * If an import job requires multiple linked files, this method can be executed multiple times, 302 | * once for each linked file. 303 | * 304 | * @param {string} file Can be one of the following: 305 | * • The internal ID, as shown in the file cabinet, of the CSV file containing data to be imported, 306 | * referenced by nlapiLoadFile, preceded by an identifier for the record sublist for which data 307 | * is being imported. For example: setLinkedFile(“item”, nlapiLoadFile(74)) 308 | * 309 | * • Raw string of the data to be imported. 310 | * 311 | * @return {void} 312 | * @since 2012.2 313 | */ 314 | nlobjCSVImport.prototype.setLinkedFile = function(file) { 315 | }; 316 | 317 | /** 318 | * Sets the name of the saved import map to be used for an import, by referencing the internal ID 319 | * or script ID of the import map. 320 | * 321 | * @param {string} savedImport The internal ID or script ID of the saved mapping to use for the import job. 322 | * The internal ID is system-defined and is displayed in the ID column 323 | * at Setup > Import/Export > Saved CSV Imports. The script ID can be defined 324 | * in the Import Assistant and is also displayed on this page. 325 | * 326 | * @return {void} 327 | * @since 2012.2 328 | */ 329 | nlobjCSVImport.prototype.setMapping = function(savedImport) { 330 | }; 331 | 332 | /** 333 | * Sets the name of the import job to be shown on the status page for CSV imports 334 | * 335 | * @param {string} jobName The text to be displayed in the Job Name column 336 | * at Setup > Import/Export > View CSV Import Status. 337 | * The default job name format is: 338 | * - - . 339 | * 340 | * @return {void} 341 | * @since 2012.2 342 | */ 343 | nlobjCSVImport.prototype.setOption = function(jobName) { 344 | }; 345 | 346 | /** 347 | * Sets the data to be imported in the primary file for an import job, by referencing a file 348 | * in the file cabinet using nlapiLoadFile, or by inputting CSV data as raw string. 349 | * 350 | * @param {string} file Can be one of the following: 351 | * • The internal ID, as shown in the file cabinet, of the CSV file containing data to be imported, 352 | * referenced by nlapiLoadFile, preceded by an identifier for the record sublist for which data 353 | * is being imported. For example: setPrimaryFile(“item”, nlapiLoadFile(74)) 354 | * 355 | * • Raw string of the data to be imported. 356 | * 357 | * @return {void} 358 | * @since 2012.2 359 | */ 360 | nlobjCSVImport.prototype.setPrimaryFile = function(file) { 361 | }; 362 | 363 | /** 364 | * Class definition for business records in the system 365 | * Return a new instance of nlobjRecord used for accessing and manipulating record objects 366 | * 367 | * @constructor 368 | * @since 2008.2 369 | */ 370 | function nlobjRecord() { 371 | } 372 | 373 | /** 374 | * Return the internalId of the record or NULL for new records 375 | * 376 | * @return {int} Returns the integer value of the record ID 377 | * @since 2008.1 378 | */ 379 | nlobjRecord.prototype.getId = function() { 380 | }; 381 | 382 | /** 383 | * Return the recordType corresponding to this record 384 | * 385 | * @return {string} The string value of the record name internal ID 386 | * @since 2008.1 387 | */ 388 | nlobjRecord.prototype.getRecordType = function() { 389 | }; 390 | 391 | /** 392 | * Return field metadata for field 393 | * 394 | * @param {string} fieldName field name 395 | * 396 | * @return {nlobjField} 397 | * @since 2009.1 398 | */ 399 | nlobjRecord.prototype.getField = function(fieldName) { 400 | }; 401 | 402 | /** 403 | * Return sublist metadata for sublist 404 | * 405 | * @param {string} type sublist name 406 | * 407 | * @return {nlobjSubList} 408 | * @since 2009.2 409 | */ 410 | nlobjRecord.prototype.getSubList = function(type) { 411 | }; 412 | 413 | /** 414 | * Return field metadata for field 415 | * 416 | * @param {string} type matrix sublist name 417 | * @param {string} fieldName matrix field name 418 | * @param {int} column linenum matrix column (1-based) 419 | * 420 | * @return {nlobjField} 421 | * @since 2009.2 422 | */ 423 | nlobjRecord.prototype.getMatrixField = function(type, fieldName, column) { 424 | }; 425 | 426 | /** 427 | * Return metadata for sublist field 428 | * 429 | * @param {string} type sublist name 430 | * @param {string} fieldName sublist field name 431 | * @param {int} [linenum] line number (1-based). If empty, the current sublist field is returned. 432 | * only settable for sublists of type list 433 | * 434 | * @return {nlobjField} 435 | * @since 2009.2 436 | */ 437 | nlobjRecord.prototype.getLineItemField = function(type, fieldName, linenum) { 438 | }; 439 | 440 | /** 441 | * Return metadata for sublist field 442 | * 443 | * @param {string} group matrix sublist name 444 | * @param {string} fieldName matrix field name 445 | * @param {int} linenum line number 446 | * @param {int} column linenum matrix column (1-based) 447 | * 448 | * @return {nlobjField} 449 | * @since 2009.2 450 | */ 451 | nlobjRecord.prototype.getLineItemMatrixField = function(group, fieldName, linenum, column) { 452 | }; 453 | 454 | /** 455 | * Use this API to get the value of a matrix field that appears on a specific line in a specific column. 456 | * 457 | * This API can be used only in the context of a matrix sublist. 458 | * 459 | * Note: Currently the Pricing sublist is the only matrix sublist type that supports SuiteScript. 460 | * 461 | * @param {string} group matrix sublist name 462 | * @param {string} fieldName matrix field name 463 | * @param {int} linenum line number 464 | * @param {int} column linenum matrix column (1-based) 465 | * 466 | * @return {string} 467 | * @since 2009.2 468 | */ 469 | nlobjRecord.prototype.getLineItemMatrixValue = function(group, fieldName, linenum, column) { 470 | }; 471 | 472 | /** 473 | * Set the value of a field 474 | * 475 | * @param {string} name field name 476 | * @param {string} value field value 477 | * 478 | * @return {void} 479 | * @since 2008.1 480 | */ 481 | nlobjRecord.prototype.setFieldValue = function(name, value) { 482 | }; 483 | 484 | /** 485 | * Set the values of a multi-select field 486 | * 487 | * @param {string} name field name 488 | * @param {string[]} values string array containing field values 489 | * 490 | * @since 2008.1 491 | */ 492 | nlobjRecord.prototype.setFieldValues = function(name, values) { 493 | }; 494 | 495 | /** 496 | * Return the value of a field 497 | * 498 | * @param {string} name field name 499 | * 500 | * @return {string} 501 | * @since 2008.1 502 | */ 503 | nlobjRecord.prototype.getFieldValue = function(name) { 504 | }; 505 | 506 | /** 507 | * Return the selected values of a multi-select field as an Array 508 | * 509 | * @param {string} name field name 510 | * 511 | * @return {string[]} 512 | * @since 2008.1 513 | */ 514 | nlobjRecord.prototype.getFieldValues = function(name) { 515 | }; 516 | 517 | /** 518 | * Set the value (via display value) of a select field 519 | * @restriction only supported for select fields 520 | * 521 | * @param {string} name field name 522 | * @param {string} text field display value 523 | * 524 | * @return {void} 525 | * @since 2008.2 526 | */ 527 | nlobjRecord.prototype.setFieldText = function(name, text) { 528 | }; 529 | 530 | /** 531 | * Set the values (via display values) of a multi-select field 532 | * @restriction only supported for multi-select fields 533 | * 534 | * @param {string} name field name 535 | * @param {string[]} texts array of field display values 536 | * 537 | * @return {void} 538 | * @since 2008.2 539 | */ 540 | nlobjRecord.prototype.setFieldTexts = function(name, texts) { 541 | }; 542 | 543 | /** 544 | * Return the display value for a select field 545 | * @restriction only supported for select fields 546 | * 547 | * @param {string} name field name 548 | * 549 | * @return {string} 550 | * @since 2008.2 551 | */ 552 | nlobjRecord.prototype.getFieldText = function(name) { 553 | }; 554 | 555 | /** 556 | * Return the selected display values of a multi-select field as an Array 557 | * 558 | * @restriction only supported for multi-select fields 559 | * 560 | * @param {string} name field name 561 | * @return {string[]} 562 | * @since 2008.2 563 | */ 564 | nlobjRecord.prototype.getFieldTexts = function(name) { 565 | }; 566 | 567 | /** 568 | * Get the value of a matrix header field 569 | * 570 | * Important: Currently the Pricing sublist is the only matrix sublist type that supports 571 | * SuiteScript. For details on working with the Pricing sublist, see Pricing Sublist in the NetSuite 572 | * Help Center 573 | * 574 | * @param {string} type matrix sublist name 575 | * @param {string} name matrix field name 576 | * @param {int} column matrix column index (1-based) 577 | * 578 | * @return {string} 579 | * @since 2009.2 580 | */ 581 | nlobjRecord.prototype.getMatrixValue = function(type, name, column) { 582 | }; 583 | 584 | /** 585 | * Set the value of a matrix header field 586 | * 587 | * @param {string} type matrix sublist name 588 | * @param {string} name matrix field name 589 | * @param {int} column matrix column index (1-based) 590 | * @param {string} value field value 591 | * 592 | * @return {void} 593 | * @since 2009.2 594 | */ 595 | nlobjRecord.prototype.setMatrixValue = function(type, name, column, value) { 596 | }; 597 | 598 | /** 599 | * Return an array of all field names on the record 600 | * 601 | * @return {string[]} 602 | * @since 2008.1 603 | */ 604 | nlobjRecord.prototype.getAllFields = function() { 605 | }; 606 | 607 | /** 608 | * 609 | * @param sublist 610 | * @param fieldName 611 | */ 612 | nlobjRecord.prototype.viewItemSubrecord = function(sublist, fieldName) { 613 | }; 614 | 615 | /** 616 | * Return an Array of all field names on a record for a particular sublist 617 | * 618 | * @param {string} group sublist name 619 | * 620 | * @return {string[]} 621 | * @since 2008.2 622 | */ 623 | nlobjRecord.prototype.getAllLineItemFields = function(group) { 624 | }; 625 | 626 | /** 627 | * Set the value of a sublist field 628 | * 629 | * @param {string} group sublist name 630 | * @param {string} name sublist field name 631 | * @param {int} line line number (1-based) 632 | * @param {string|int} value sublist field value 633 | * 634 | * @return {void} 635 | * @since 2008.1 636 | */ 637 | nlobjRecord.prototype.setLineItemValue = function(group, name, line, value) { 638 | }; 639 | 640 | /** 641 | * Set the value of a sublist field 642 | * 643 | * @param {string} group sublist name 644 | * @param {string} name sublist field name 645 | * @param {int} line line number (1-based) 646 | * @param {string} value datetime value 647 | * 648 | * @return {void} 649 | * @since 2013.2 650 | */ 651 | nlobjRecord.prototype.setLineItemDateTimeValue = function(group, name, line, value) { 652 | }; 653 | 654 | /** 655 | * Set the value of a sublist field 656 | * 657 | * @param {string} group sublist name 658 | * @param {string} name sublist field name 659 | * @param {int} line line number (1-based) 660 | * @param {string} value datetime value 661 | * @param {string} timezone value 662 | * 663 | * @return {void} 664 | * @since 2013.2 665 | */ 666 | nlobjRecord.prototype.setLineItemDateTimeValue = function(group, name, line, value, timezone) { 667 | }; 668 | 669 | /** 670 | * Return the value of a sublist field 671 | * 672 | * @param {string} group sublist name 673 | * @param {string} name sublist field name 674 | * @param {int} line line number (1-based) 675 | * 676 | * @return {string} 677 | * @since 2008.1 678 | */ 679 | nlobjRecord.prototype.getLineItemValue = function(group, name, line) { 680 | }; 681 | 682 | /** 683 | * Returns the values of a multiselect sublist field on a selected line. One example of a multiselect 684 | * sublist field is the Serial Numbers field on the Items sublist. 685 | * 686 | * This function is not supported in client SuiteScript. It is meant to be used in user event scripts 687 | * 688 | * @param {string} group The sublist internal ID (for example, use addressbook as the ID for the Address sublist) 689 | * @param {string} name The internal ID of the multiselect field 690 | * @param {int} line linenum number (1-based) 691 | * 692 | * @return {string[]} An array of string values for the multiselect sublist field 693 | * @since 2012.1 694 | */ 695 | nlobjRecord.prototype.getLineItemValues = function(group, name, line) { 696 | }; 697 | 698 | /** 699 | * Return the value of a sublist field 700 | * 701 | * @param {string} group sublist name 702 | * @param {string} name sublist field name 703 | * @param {int} line line number (1-based) 704 | * @param {string} [timezone] value 705 | * 706 | * @return {void} 707 | * @since 2013.2 708 | */ 709 | nlobjRecord.prototype.getLineItemDateTimeValue = function(group, name, line, timezone) { 710 | }; 711 | 712 | /** 713 | * Return the text value of a sublist field 714 | * 715 | * @param {string} group sublist name 716 | * @param {string} name sublist field name 717 | * @param {int} line line number (1-based) 718 | * 719 | * @return {string} 720 | * @since 2008.2 721 | */ 722 | nlobjRecord.prototype.getLineItemText = function(group, name, line) { 723 | }; 724 | 725 | /** 726 | * Set the current value of a sublist field 727 | * 728 | * @param {string} group sublist name 729 | * @param {string} name sublist field name 730 | * @param {string|int} value sublist field value 731 | * 732 | * @return {void} 733 | * @since 2009.2 734 | */ 735 | nlobjRecord.prototype.setCurrentLineItemValue = function(group, name, value) { 736 | }; 737 | 738 | /** 739 | * Set the current value of a sublist field using the display name 740 | * 741 | * @param {string} group sublist name 742 | * @param {string} name sublist field name 743 | * @param {string} value sublist field value 744 | * 745 | * @return {void} 746 | * @since 2009.2 747 | */ 748 | nlobjRecord.prototype.setCurrentLineItemText = function(group, name, value) { 749 | }; 750 | 751 | /** 752 | * Set the current value of a sublist field 753 | * 754 | * @param {string} group sublist name 755 | * @param {string} name sublist field name 756 | * @param {string} value sublist field value 757 | * @param {string} [timezone] value 758 | * 759 | * @return {void} 760 | * @since 2013.2 761 | */ 762 | nlobjRecord.prototype.setCurrentLineItemDateTimeValue = function(group, name, value, timezone) { 763 | }; 764 | 765 | /** 766 | * Returns the values of a multiselect sublist field on the currently selected line. 767 | * One example of a multiselect sublist field is the Serial Numbers field on the Items sublist. 768 | * 769 | * This function is not supported in client SuiteScript. It is meant to be used in user event scripts. 770 | * 771 | * @param {string} group The sublist internal ID (for example, use addressbook as the ID for the Address sublist) 772 | * @param {string} name The name of the multiselect field 773 | * 774 | * @return {string[]} 775 | * @since 2012.1 776 | */ 777 | nlobjRecord.prototype.getCurrentLineItemValues = function(group, name) { 778 | }; 779 | 780 | /** 781 | * Return the current value of a sublist field 782 | * 783 | * @param {string} group sublist name 784 | * @param {string} name sublist field name 785 | * @param {string} [timezone] value 786 | * 787 | * @return {string} 788 | * @since 2013.2 789 | */ 790 | nlobjRecord.prototype.getCurrentLineItemDateTimeValue = function(group, name, timezone) { 791 | }; 792 | 793 | /** 794 | * Return the current value of a sublist field 795 | * 796 | * @param {string} group sublist name 797 | * @param {string} name sublist field name 798 | * 799 | * @return {string} 800 | * @since 2009.2 801 | */ 802 | nlobjRecord.prototype.getCurrentLineItemValue = function(group, name) { 803 | }; 804 | 805 | /** 806 | * Return the current display value of a sublist field 807 | * 808 | * @param {string} group sublist name 809 | * @param {string} name sublist field name 810 | * 811 | * @return {string} 812 | * @since 2009.2 813 | */ 814 | nlobjRecord.prototype.getCurrentLineItemText = function(group, name) { 815 | }; 816 | 817 | /** 818 | * Set the current value of a sublist matrix field 819 | * 820 | * @param {string} group matrix sublist name 821 | * @param {string} name matrix field name 822 | * @param {int} column matrix field column index (1-based) 823 | * @param {string} value matrix field value 824 | * 825 | * @return {void} 826 | * @since 2009.2 827 | */ 828 | nlobjRecord.prototype.setCurrentLineItemMatrixValue = function(group, name, column, value) { 829 | }; 830 | 831 | /** 832 | * Return the current value of a sublist matrix field 833 | * 834 | * @param {string} group matrix sublist name 835 | * @param {string} name matrix field name 836 | * @param {int} column matrix field column index (1-based) 837 | * 838 | * @return {string} 839 | * @since 2009.2 840 | */ 841 | nlobjRecord.prototype.getCurrentLineItemMatrixValue = function(group, name, column) { 842 | }; 843 | 844 | nlobjRecord.prototype.createSubrecord = function(fieldName) { 845 | }; 846 | 847 | nlobjRecord.prototype.viewSubrecord = function(fieldName) { 848 | }; 849 | 850 | nlobjRecord.prototype.editSubrecord = function(fieldName) { 851 | }; 852 | 853 | nlobjRecord.prototype.removeSubrecord = function(fieldName) { 854 | }; 855 | 856 | nlobjRecord.prototype.createCurrentLineItemSubrecord = function(sublist, fieldName) { 857 | }; 858 | 859 | nlobjRecord.prototype.viewCurrentItemSubrecord = function(sublist, fieldName) { 860 | }; 861 | 862 | nlobjRecord.prototype.editCurrentLineItemSubrecord = function(sublist, fieldName) { 863 | }; 864 | 865 | nlobjRecord.prototype.removeCurrentLineItemSubrecord = function(sublist, fieldName) { 866 | }; 867 | 868 | /** 869 | * Return the number of columns for a matrix field 870 | * 871 | * @param {string} group matrix sublist name 872 | * @param {string} name matrix field name 873 | * 874 | * @return {int} 875 | * @since 2009.2 876 | */ 877 | nlobjRecord.prototype.getMatrixCount = function(group, name) { 878 | }; 879 | 880 | /** 881 | * Return the number of lines in a sublist 882 | * 883 | * @param {string} group sublist name 884 | * 885 | * @return {int} 886 | * @since 2009.2 887 | */ 888 | nlobjRecord.prototype.getLineItemCount = function(group) { 889 | }; 890 | 891 | /** 892 | * Return line number for 1st occurrence of field value in a sublist column 893 | * 894 | * @param {string} group sublist name 895 | * @param {string} fieldName sublist field name 896 | * @param {string} value sublist field value 897 | * 898 | * @return {int} 899 | * @since 2009.2 900 | */ 901 | nlobjRecord.prototype.findLineItemValue = function(group, fieldName, value) { 902 | }; 903 | 904 | /** 905 | * Return line number for 1st occurrence of field value in a sublist column 906 | * 907 | * @param {string} group sublist name 908 | * @param {string} fieldName sublist field name 909 | * @param {int} column matrix column index (1-based) 910 | * @param {string} value matrix field value 911 | * 912 | * @return {int} 913 | * @since 2009.2 914 | */ 915 | nlobjRecord.prototype.findLineItemMatrixValue = function(group, fieldName, column, value) { 916 | }; 917 | 918 | /** 919 | * Insert a new line into a sublist 920 | * 921 | * @param {string} group sublist name 922 | * @param {int} [line] line index at which to insert line 923 | * 924 | * @return {void} 925 | * @since 2009.2 926 | */ 927 | nlobjRecord.prototype.insertLineItem = function(group, line) { 928 | }; 929 | 930 | /** 931 | * Remove an existing line from a sublist 932 | * 933 | * @param {string} group sublist name 934 | * @param {int} [line] line number to remove 935 | * 936 | * @return {void} 937 | * @since 2009.2 938 | */ 939 | nlobjRecord.prototype.removeLineItem = function(group, line) { 940 | }; 941 | 942 | /** 943 | * Insert and select a new line in a sublist 944 | * 945 | * @param {string} group sublist name 946 | * 947 | * @return {void} 948 | * @since 2009.2 949 | */ 950 | nlobjRecord.prototype.selectNewLineItem = function(group) { 951 | }; 952 | 953 | /** 954 | * Select an existing line in a sublist 955 | * 956 | * @param {string} group sublist name 957 | * @param {int} line line number to select 958 | * 959 | * @return {void} 960 | * @since 2009.2 961 | */ 962 | nlobjRecord.prototype.selectLineItem = function(group, line) { 963 | }; 964 | 965 | /** 966 | * Commit the current line in a sublist 967 | * 968 | * @param {string} group sublist name 969 | * 970 | * @return {void} 971 | * @since 2009.2 972 | */ 973 | nlobjRecord.prototype.commitLineItem = function(group) { 974 | }; 975 | 976 | /** 977 | * Cancels any uncommitted changes to the current line of a sublist 978 | * 979 | * @param {string} group The sublist internal ID 980 | * (for example, use addressbook as the ID for the Address sublist) 981 | * 982 | * @return {void} 983 | */ 984 | nlobjRecord.prototype.cancelLineItem = function(group) { 985 | }; 986 | 987 | /** 988 | * Set the value of a field 989 | * 990 | * @param {string} name field name 991 | * @param {string} value field value 992 | * @param {string} [timezone] Olson value 993 | * 994 | * @return {void} 995 | * @since 2013.2 996 | */ 997 | nlobjRecord.prototype.setDateTimeValue = function(name, value, timezone) { 998 | }; 999 | 1000 | /** 1001 | * Return the value of a field on the current record on a page 1002 | * 1003 | * @restriction supported in client and user event scripts only 1004 | * 1005 | * @param {string} fieldName the field name 1006 | * @param {string} [timezone] Olson value 1007 | * 1008 | * @return {string} 1009 | * @since 2013.2 1010 | */ 1011 | nlobjRecord.prototype.getDateTimeValue = function(fieldName, timezone) { 1012 | }; 1013 | -------------------------------------------------------------------------------- /scheduling.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SuiteScript Scheduling APIs 3 | * 4 | * The scheduling APIs are used to start, gather information about, and pause, scripts until a more appropriate time. 5 | */ 6 | 7 | 8 | /** 9 | * Creates a job to initiate an instance of the specified workflow. 10 | * 11 | * This job is then placed in the scheduling queue. The workflow instance is initiated after 12 | * the job reaches the top of the queue. An error is thrown if the record in the workflow 13 | * is invalid or unsupported for that workflow. 14 | * 15 | * @restriction Server SuiteScript only 16 | * @governance 20 units 17 | * 18 | * @param {string} recordType The record type of the workflow base record 19 | * @param {int} [id] Internal ID of the base record 20 | * @param {int, string} [workflowId] The internal ID (int) or script ID (string) for the 21 | * workflow definition. This is the ID that appears in the 22 | * ID field on the Workflow Definition Page. 23 | * @param {object} initialValues Name/value pairs representing defaults used during 24 | * workflow initialization 25 | * 26 | * @return {string} If the workflow job is successfully placed in queue, the return value is QUEUED 27 | * If the workflow job is not successfully placed in queue, 28 | * one of the following values is returned: 29 | * 30 | * INQUEUE – Returned if the workflow is already in queue and waiting to 31 | * run. If this status is returned, you must wait until the workflow 32 | * job is finished before attempting to place another instance of the 33 | * workflow in the queue. 34 | * 35 | * INPROGRESS – Returned if the workflow is currently running. 36 | * 37 | * @since 2014.2 38 | */ 39 | function nlapiInitiateWorkflowAsync(recordType, id, workflowId, initialValues) { 40 | } 41 | 42 | 43 | /** 44 | * Queue a scheduled script for immediate execution and return the status QUEUED if successful 45 | * 46 | * @restriction Server SuiteScript only 47 | * @governance 20 units 48 | * 49 | * @param {string, int} script script ID or internal ID of scheduled script 50 | * @param {string, int} [deployment] script ID or internal ID of scheduled script deployment 51 | * If empty, the first "free" deployment (i.e. status = Not Scheduled or Completed) will be used 52 | * @param {Object} [parameters] Object of parameter name->values used in this scheduled script instance 53 | * 54 | * @return {string} QUEUED or null if no available deployments were found or the current status 55 | * of the deployment specified if it was not available 56 | * @since 2008.1 57 | */ 58 | function nlapiScheduleScript(script, deployment, parameters) { 59 | } 60 | 61 | /** 62 | * Creates a recovery point saving the state of the script’s execution. When NetSuite resumes the 63 | * execution of the script, it resumes the script at the specified recovery point. Also note that 64 | * when the script is resumed, its governance units are reset. Be aware, however, all scheduled 65 | * scripts have a 50 MB memory limit 66 | * 67 | * Note you can use nlapiSetRecoveryPoint() in conjunction with nlapiYieldScript() to effectively 68 | * pause the script until a later time when it is more appropriate to run the script 69 | * 70 | * Important: This API can only be called from scheduled scripts; calling this API from any 71 | * other script type will result in an error 72 | * 73 | * The nlapiSetRecoveryPoint() API consumes 100 units per call 74 | * 75 | * @return {Object} The returned has will contain the following 76 | * {string} status: 77 | * • SUCCESS – Save point was created 78 | * • RESUME – Script is being resumed 79 | * • FAILURE – The recovery point was unable to be created. Returns the reason 80 | * for the failure and the footprint size of the script 81 | * 82 | * {string} reason: 83 | * • SS_NLAPIYIELDSCRIPT - Yield was called 84 | * • SS_ABORT -The JVM unintentionally stopped (native error, no response, 85 | * etc.) --mimics normal "ABORT" states 86 | * • SS_MAJOR_RELEASE – A major NetSuite release is pending, processes are being stopped 87 | * • SS_EXCESSIVE_MEMORY_FOOTPRINT – The saved object is too big 88 | * • SS_CANCELLED – A user requested that the script stop 89 | * • SS_DISALLOWED_OBJECT_REFERENCE – The script is attempting to serialize an object 90 | * that is not serializable (see Supported Objects) 91 | * 92 | * {int} size: 93 | * • The size of the saved object 94 | * 95 | * {string} information: 96 | * • Additional information about the status 97 | */ 98 | function nlapiSetRecoveryPoint() { 99 | } 100 | 101 | /** 102 | * Creates a recovery point and then reschedules the script. The newly rescheduled script has its 103 | * governance units reset, and is then placed at the back of the scheduled script queue. To 104 | * summarize, nlapiYieldScript works as follows: 105 | * 1. Creates a new recovery point 106 | * 2. Creates a new scheduled script with a governance reset 107 | * 3. Associates the recovery point to the scheduled script 108 | * 4. Puts the script at the back of the scheduled script queue 109 | * 110 | * Note: If the yield call fails, a FAILURE status will be returned. On success, the call does 111 | * not return until the script is resumed 112 | * 113 | * Calling this function consumes no governance units. Note also, calling this API resets the unit 114 | * counter for the currently executing script. Be aware, however, all scheduled scripts have a 50 115 | * MB memory limit. Calling this API will not reset the memory size of the script to 0. It only 116 | * resets the governance units. For complete details on scheduled script memory limits, see 117 | * Understanding Memory Usage in Scheduled Scripts 118 | * 119 | * Important: This API can only be called from scheduled scripts. Calling this API from any 120 | * other script type will result in an error 121 | * 122 | * @return {Object} The returned has will contain the following 123 | * {string} status: 124 | * • RESUME – Script is being resumed 125 | * • FAILURE – The recovery point was unable to be created. Returns the reason 126 | * for the failure and the footprint size of the script 127 | * 128 | * {string} reason: 129 | * • SS_NLAPIYIELTDSCRIPT - Yield was called 130 | * • SS_ABORT -The JVM unintentionally stopped (native error, no response, 131 | * etc.) --mimics normal "ABORT" states 132 | * • SS_MAJOR_RELEASE – A major NetSuite release is pending, processes are being stopped 133 | * • SS_EXCESSIVE_MEMORY_FOOTPRINT – The saved object is too big 134 | * • SS_CANCELLED – A user requested that the script stop 135 | * • SS_DISALLOWED_OBJECT_REFERENCE – The script is attempting to 136 | * serialize an object that is not serializable (see Supported Objects) 137 | * 138 | * {int} size: 139 | * • The size of the saved object 140 | * 141 | * {string} information: 142 | * • Additional information about the status 143 | */ 144 | function nlapiYieldScript() { 145 | } 146 | -------------------------------------------------------------------------------- /search.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SuiteScript Search APIs 3 | * 4 | * Similar to much of the searching functionality available through the NetSuite UI, SuiteScript Search APIs 5 | * allow you to retrieve real-time data from your account. You can search for a single record by keywords, 6 | * create saved searches, search for duplicate records, or return a set of records that match filters you define. 7 | */ 8 | 9 | 10 | /** 11 | * Creates a new search. 12 | * 13 | * The search can be modified and run as an ad-hoc search, without saving it. 14 | * Alternatively, calling nlobjSearch.saveSearch(title, scriptId) will save the search to the database, 15 | * so it can be reused later in the UI or using nlapiLoadSearch(type, id). 16 | * 17 | * Note: You can further filter the returned nlobjSearch object by passing additional filter values. 18 | * You will do this using the nlobjSearch.addFilter(filter) method or nlobjSearch.addFilters(filters) method. 19 | * 20 | * @param {string} type The record internal ID of the record type you are searching 21 | * @param {nlobjSearchFilter | nlobjSearchFilter[] | Object[] } [filters] 22 | * @param {nlobjSearchColumn|nlobjSearchColumn[]} [columns] 23 | * 24 | * @return {nlobjSearch} 25 | * @since 2012.1 26 | */ 27 | function nlapiCreateSearch(type, filters, columns) { 28 | } 29 | 30 | /** 31 | * Loads an existing saved search. 32 | * The saved search could have been created using the UI, or created using 33 | * nlapiCreateSearch(type, filters, columns) in conjunction with nlobjSearch.saveSearch(title, scriptId). 34 | * 35 | * @governance 5 units 36 | * 37 | * @param {string} [type] 38 | * @param {string} id The internal ID or script ID of the saved search. 39 | * The script ID of the saved search is required, regardless of whether you specify the search type. 40 | * If you do not specify the search type, you must set type to null and then set the script/search ID. 41 | * 42 | * @return {nlobjSearch} 43 | * @since 2012.1 44 | */ 45 | function nlapiLoadSearch(type, id) { 46 | } 47 | 48 | /** 49 | * Perform a duplicate record search using Duplicate Detection criteria 50 | * 51 | * @governance 10 units 52 | * @restriction returns the first 1000 rows in the search 53 | * 54 | * @param {string} type The recordType you are checking duplicates for 55 | * (for example, customer|lead|prospect|partner|vendor|contact) 56 | * @param {string[]} [fields] array of field names used to detect duplicate 57 | * (for example, companyname|email|name|phone|address1|city|state|zipcode) 58 | * @param {int} [id] internal ID of existing record. Depending on the use case, id may or may not be a required argument 59 | * @return {nlobjSearchResult[]} Returns an Array of nlobjSearchResult objects corresponding to the duplicate records 60 | * @since 2008.1 61 | */ 62 | function nlapiSearchDuplicate(type, fields, id) { 63 | } 64 | 65 | /** 66 | * Perform a global record search across the system 67 | * @governance 10 units 68 | * @restriction returns the first 1000 rows in the search 69 | * 70 | * @param {string} keywords Global search keywords string or expression 71 | * @return {nlobjSearchResult[]} Returns an Array of nlobjSearchResult objects containing the following four columns: 72 | * name, type (as shown in the UI), info1, and info2 73 | * @since 2008.1 74 | */ 75 | function nlapiSearchGlobal(keywords) { 76 | } 77 | 78 | /** 79 | * Perform a record search using an existing search or filters and columns 80 | * 81 | * This API is supported in client, user event, scheduled, portlet, and Suitelet scripts 82 | * 83 | * @governance 10 units 84 | * @restriction returns the first 1000 rows in the search 85 | * Also note that in search/lookup operations, long text fields are truncated at 4,000 characters. 86 | * 87 | * @param {string} type record type ID 88 | * @param {int, string} [id] The internal ID or script ID for the saved search to use for search 89 | * @param {nlobjSearchFilter, nlobjSearchFilter[]} [filters] [optional] A single nlobjSearchFilter object 90 | * - or - an array of nlobjSearchFilter objects 91 | * @param {nlobjSearchColumn, nlobjSearchColumn[]} [columns] [optional] A single nlobjSearchColumn object 92 | * - or - an array of nlobjSearchColumn objects 93 | * 94 | * @return {nlobjSearchResult[]|null} Returns an array of nlobjSearchResult objects corresponding to the searched 95 | * records, if no records are found null is returned. 96 | * 97 | * @exception {SSS_INVALID_RECORD_TYPE} 98 | * @exception {SSS_TYPE_ARG_REQD} 99 | * @exception {SSS_INVALID_SRCH_ID} 100 | * @exception {SSS_INVALID_SRCH_FILTER} 101 | * @exception {SSS_INVALID_SRCH_FILTER_JOIN} 102 | * @exception {SSS_INVALID_SRCH_OPERATOR} 103 | * @exception {SSS_INVALID_SRCH_COL_NAME} 104 | * @exception {SSS_INVALID_SRCH_COL_JOIN} 105 | * @since 2007.0 106 | */ 107 | function nlapiSearchRecord(type, id, filters, columns) { 108 | } 109 | 110 | /** 111 | * Primary object used to encapsulate a NetSuite saved search. 112 | * Note, however, you are not required to save the search results returned in this object. 113 | * 114 | * @constructor 115 | */ 116 | function nlobjSearch() { 117 | } 118 | 119 | /** 120 | * Adds a single return column to the search. Note that existing columns on the search are not changed. 121 | * 122 | * @param {nlobjSearchColumn} column The nlobjSearchColumn you want added to the search 123 | * 124 | * @return {void} 125 | * @since 2012.1 126 | */ 127 | nlobjSearch.prototype.addColumn = function(column) { 128 | }; 129 | 130 | /** 131 | * Add multiple return column to the search. Note that existing columns on the search are not changed. 132 | * 133 | * @param {nlobjSearchColumn[]} columns The nlobjSearchColumn set you want added to the search 134 | * 135 | * @return {void} 136 | * @since 2012.1 137 | */ 138 | nlobjSearch.prototype.addColumns = function(columns) { 139 | }; 140 | 141 | /** 142 | * Adds a single search filter. 143 | * 144 | * Note that existing filters on the search are not changed. 145 | * Note: This method does not accept a search filter expression (Object[]) as parameter. 146 | * Only a single search filter (nlobjSearchFilter) is accepted. 147 | * 148 | * @param {nlobjSearchFilter} filter 149 | * 150 | * @return {void} 151 | * @since 2012.1 152 | */ 153 | nlobjSearch.prototype.addFilter = function(filter) { 154 | }; 155 | 156 | /** 157 | * Adds a search filter list. 158 | * 159 | * Note that existing filters on the search are not changed. 160 | * Note: This method does not accept a search filter expression (Object[]) as parameter. 161 | * Only a single search filter (nlobjSearchFilter) is accepted. 162 | * 163 | * @param {nlobjSearchFilter[]} filters 164 | * 165 | * @return {void} 166 | * @since 2012.1 167 | */ 168 | nlobjSearch.prototype.addFilters = function(filters) { 169 | }; 170 | 171 | /** 172 | * Deletes a given saved search that was created through scripting or through the UI. 173 | * If you have created a saved search through the UI, you can load the search using 174 | * nlapiLoadSearch(type, id) and then call deleteSearch() to delete it. 175 | * In scripting if you have created a search using nlapiCreateSearch(type, filters, columns) 176 | * and saved the search using the nlobjSearch.saveSearch(title, scriptId), 177 | * you can then load the search and call deleteSearch() to delete it. 178 | * 179 | * @return {void} 180 | * @since 2012.1 181 | */ 182 | nlobjSearch.prototype.deleteSearch = function() { 183 | }; 184 | 185 | /** 186 | * Gets the search return columns for the search 187 | * 188 | * @return {nlobjSearchColumn[]} 189 | * @since 2012.1 190 | */ 191 | nlobjSearch.prototype.getColumns = function() { 192 | }; 193 | 194 | /** 195 | * Gets the filter expression for the search 196 | * 197 | * @return {Object[]} 198 | * @since 2012.2 199 | */ 200 | nlobjSearch.prototype.getFilterExpression = function(param) { 201 | }; 202 | 203 | /** 204 | * Gets the filters for the search. 205 | * 206 | * Note: This method does not return a search filter expression (Object[]). Only a search filter list 207 | * (nlobjSearchFilter[]) is returned. If you want to get a search filter expression, see getFilterExpression(). 208 | * 209 | * @return {nlobjSearchFilter[]} 210 | * @since 2012.1 211 | */ 212 | nlobjSearch.prototype.getFilters = function() { 213 | }; 214 | 215 | /** 216 | * Gets the internal ID of the search. The internal ID is available only when the search is either 217 | * loaded using nlapiLoadSearch(type, id) or has been saved using nlobjSearch.saveSearch(title, scriptId). 218 | * 219 | * If this is an ad-hoc search (created with nlapiCreateSearch(type, filters, columns)), this method will return null. 220 | * 221 | * @return {string|null} Typical return values will be something like 55 or 234 or 87. 222 | * You will not receive a value such as customsearch_mysearch. Any ID prefixed with 223 | * customsearch is considered a script ID, not the search’s internal system ID. 224 | * 225 | * @return {int} 226 | * @since 2012.1 227 | */ 228 | nlobjSearch.prototype.getId = function() { 229 | }; 230 | 231 | /** 232 | * Gets whether the nlobjSearch has been set as public search 233 | * 234 | * @return {boolean} 235 | * @since 2012.1 236 | */ 237 | nlobjSearch.prototype.getIsPublic = function() { 238 | }; 239 | 240 | /** 241 | * Gets the script ID of the search. The script ID is available only when the search is either 242 | * loaded using nlapiLoadSearch(type, id) or has been saved using nlobjSearch.saveSearch(title, scriptId). 243 | * 244 | * If this is an ad-hoc search (created with nlapiCreateSearch(type, filters, columns)), this method will return null. 245 | * 246 | * @return {string} The script ID of the search as a string. 247 | * Typical return values will be something like customsearch_mysearch or customsearchnewinvoices. 248 | * You will not receive values such as 55 or 234 or 87. These are considered internal system IDs 249 | * assigned by NetSuite when you first save the search. 250 | * 251 | * @since 2012.1 252 | */ 253 | nlobjSearch.prototype.getScriptId = function() { 254 | }; 255 | 256 | /** 257 | * Returns the record type that the search was based on. 258 | * This method is helpful when you have the internal ID of the search, 259 | * but do not know the record type the search was based on. 260 | * 261 | * @return {string} For example, if the search was on a Customer record, customer will be returned; 262 | * if the search was on the Sales Order record type, salesorder will be returned. 263 | * @since 2012.1 264 | */ 265 | nlobjSearch.prototype.getSearchType = function() { 266 | }; 267 | 268 | /** 269 | * Runs an ad-hoc search, returning the results. 270 | * Be aware that calling this method does NOT save the search. Using this method in conjunction 271 | * with nlapiCreateSearch(type, filters, columns) allows you to create and run ad-hoc searches 272 | * that are never saved to the database, much like nlapiSearchRecord(...). 273 | * 274 | * Note that this method returns the nlobjSearchResultSet object, which provides you with more 275 | * flexibility when working with or iterating through your search results. 276 | * Therefore, you may also want to use runSearch() in conjunction with nlapiLoadSearch(...). 277 | * By doing so you can load an existing saved search, call runSearch(), and then (if you choose): 278 | * • retrieve a slice of the search results from anywhere in the result list 279 | * • paginate through the search results. 280 | * 281 | * @return {nlobjSearchResultSet} 282 | * @since 2012.1 283 | */ 284 | nlobjSearch.prototype.runSearch = function(param) { 285 | }; 286 | 287 | /** 288 | * Saves the search created by nlapiCreateSearch(type, filters, columns) 289 | * 290 | * Important: Loading a search and saving it with a different title and/or script ID does not create a new search. 291 | * It only modifies the title and/or script ID for the existing search. 292 | * 293 | * @governance 5 units 294 | * 295 | * @param {string} [title] The title you want to give the saved search. 296 | * Note that title is required when saving a new search, but optional when saving a search that 297 | * was loaded using nlapiLoadSearch(type, id) or has already been saved by calling 298 | * saveSearch(title, scriptId) before. 299 | * @param {string} [scriptId] The script ID you want to assign to the saved search. 300 | * All saved search script IDs must be prefixed with customsearch 301 | * 302 | * @return {string} The internal ID of the search 303 | * @since 2012.1 304 | */ 305 | nlobjSearch.prototype.saveSearch = function(title, scriptId) { 306 | }; 307 | 308 | /** 309 | * Sets the return columns for this search, overwriting any prior columns. 310 | * If null is passed in it is treated as if it were an empty array and removes any existing columns on the search 311 | * 312 | * @param {nlobjSearchColumn[]} columns 313 | * 314 | * @return {void} 315 | * @since 2012.1 316 | */ 317 | nlobjSearch.prototype.setColumns = function(columns) { 318 | }; 319 | 320 | /** 321 | * Sets the search filter expression, overwriting any prior filters. 322 | * If null is passed in, it is treated as if it was an empty array and removes any existing filters on this search. 323 | * 324 | * Note: This method can be followed by the addFilter(filter) and addFilters(filters) methods. 325 | * The additional filters will be appended with the current filters on the search through an ‘AND’ operator. 326 | * 327 | * @param {Object[]} filterExpression 328 | * 329 | * @return {void} 330 | * @since 2012.2 331 | */ 332 | nlobjSearch.prototype.setFilterExpression = function(filterExpression) { 333 | }; 334 | 335 | /** 336 | * Sets the filters for this search, overwriting any prior filters. 337 | * If null is passed in it is treated as if it were an empty array and removes any existing filters on this search. 338 | * 339 | * Note: This method does not accept a search filter expression (Object[]) as parameter. 340 | * Only a search filter list (nlobjSearchFilter[]) is accepted. 341 | * 342 | * @param {nlobjSearchFilter[]} filters 343 | * 344 | * @return {void} 345 | * @since 2012.1 346 | */ 347 | nlobjSearch.prototype.setFilters = function(filters) { 348 | }; 349 | 350 | /** 351 | * Sets whether the search is public or private. 352 | * By default, all searches created through nlapiCreateSearch(type, filters, columns) are private. 353 | * 354 | * @param isPublic 355 | * 356 | * @return {void} 357 | * @since 2012.1 358 | */ 359 | nlobjSearch.prototype.setIsPublic = function(isPublic) { 360 | }; 361 | 362 | /** 363 | * Acts like nlapiSetRedirectURL(type, identifier, id, editmode, parameters) but redirects end users to a 364 | * populated search definition page. You can use this method with any kind of search that is held in the 365 | * nlobjSearch object. This could be: 366 | * • an existing saved search, 367 | * • an ad-hoc search that you are building in SuiteScript, or 368 | * • a search you have loaded and then modified (using addFilter, setFilters, addFilters, addColumn, addColumns, 369 | * or setColumns) but do not save. 370 | * 371 | * Note that this method does not return a URL. It works by loading a search into the session, 372 | * and then redirecting to a URL that loads the search definition page. 373 | * 374 | * This method is supported in afterSubmit user event scripts and in client scripts. 375 | * 376 | * @return {void} 377 | * @since 2012.1 378 | */ 379 | nlobjSearch.prototype.setRedirectURLToSearch = function() { 380 | }; 381 | 382 | /** 383 | * Acts like nlapiSetRedirectURL(type, identifier, id, editmode, parameters) but redirects end users to a search 384 | * results page. You can use this method with any kind of search that is held in the nlobjSearch object. This could be: 385 | * • an existing saved search, 386 | * • an ad-hoc search that you are building in SuiteScript, or 387 | * • a search you have loaded and then modified (using addFilter, setFilters, addFilters, addColumn, addColumns, 388 | * or setColumns) but do not save. 389 | * 390 | * Note that this method does not return a URL. It works by loading a search into the session, and then redirecting 391 | * to a URL that loads the search results. 392 | * 393 | * This method is supported in afterSubmit user event scripts and in client scripts. 394 | * 395 | * @return {void} 396 | * @since 2012.1 397 | */ 398 | nlobjSearch.prototype.setRedirectURLToSearchResults = function() { 399 | }; 400 | 401 | /** 402 | * Return a new instance of nlobjSearchColumn used for column objects used to define search return columns 403 | * 404 | * @constructor 405 | * 406 | * @param {string} name column name 407 | * @param {string} [join] internal ID for joined search where this column is defined 408 | * @param {string} [summary] The summary type for this column (group, sum, count, avg, min, max) 409 | * 410 | * @since 2007.0 411 | */ 412 | function nlobjSearchColumn(name, join, summary) { 413 | } 414 | 415 | /** 416 | * Return the name of this search column 417 | * 418 | * @return {string} 419 | * @since 2008.1 420 | */ 421 | nlobjSearchColumn.prototype.getName = function() { 422 | }; 423 | 424 | /** 425 | * Return the join id for this search column 426 | * 427 | * @return {string} 428 | * @since 2008.1 429 | */ 430 | nlobjSearchColumn.prototype.getJoin = function() { 431 | }; 432 | 433 | /** 434 | * Return the label of this search column 435 | * 436 | * @return {string} 437 | * @since 2009.1 438 | */ 439 | nlobjSearchColumn.prototype.getLabel = function() { 440 | }; 441 | 442 | /** 443 | * Set the label used for this column 444 | * 445 | * @param {string} label The label used for this column 446 | * 447 | * @returns {nlobjSearchColumn} 448 | * @since 2011.1 449 | */ 450 | nlobjSearchColumn.prototype.setLabel = function(label) { 451 | }; 452 | 453 | /** 454 | * Return the summary type (avg,group,sum,count) of this search column 455 | * 456 | * @return {string} 457 | * @since 2008.1 458 | */ 459 | nlobjSearchColumn.prototype.getSummary = function() { 460 | }; 461 | 462 | /** 463 | * @return {string} Returns the formula used for this column 464 | * @since 2009.2 465 | */ 466 | nlobjSearchColumn.prototype.getFormula = function() { 467 | }; 468 | 469 | /** 470 | * Set the formula used for this column. Name of the column can either be formulatext, 471 | * formulanumeric, formuladatetime, formulapercent, or formulacurrency 472 | * 473 | * @param {string} formula The formula used for this column 474 | * 475 | * @return {nlobjSearchColumn} 476 | * @since 2011.1 477 | */ 478 | nlobjSearchColumn.prototype.setFormula = function(formula) { 479 | }; 480 | 481 | /** 482 | * @return {string} The function used in this search column 483 | * @since 2009.2 484 | */ 485 | nlobjSearchColumn.prototype.getFunction = function() { 486 | }; 487 | 488 | /** 489 | * Sets the special function used for this column 490 | * 491 | * @param {string} functionID Special function used for this column 492 | * 493 | * The following is a list of supported functions and their internal IDs: 494 | * ID Name Date Function Output 495 | * ------------------|-----------------------|----------------|------------- 496 | * percentOfTotal % of Total No percent 497 | * absoluteValue Absolute Value No 498 | * ageInDays Age In Days Yes integer 499 | * ageInHours Age In Hours Yes integer 500 | * ageInMonths Age In Months Yes integer 501 | * ageInWeeks Age In Weeks Yes integer 502 | * ageInYears Age In Years Yes integer 503 | * calendarWeek Calendar Week Yes date 504 | * day Day Yes date 505 | * month Month Yes text 506 | * negate Negate No 507 | * numberAsTime Number as Time No text 508 | * quarter Quarter Yes text 509 | * rank Rank No integer 510 | * round Round No 511 | * roundToHundredths Round to Hundredths No 512 | * roundToTenths Round to Tenths No 513 | * weekOfYear Week of Year Yes text 514 | * year Year Yes text 515 | * 516 | * @return {nlobjSearchColumn} 517 | * @since 2011.1 518 | */ 519 | nlobjSearchColumn.prototype.setFunction = function(functionID) { 520 | }; 521 | 522 | /** 523 | * Returns the sort direction for this column 524 | * 525 | * @return {string} 526 | * @since 2008.1 527 | */ 528 | nlobjSearchColumn.prototype.getSort = function() { 529 | }; 530 | 531 | /** 532 | * Return nlobjSearchColumn sorted in either ascending or descending order 533 | * 534 | * @param {boolean} [order=false] If not set, defaults to false, which returns column data in ascending order 535 | * 536 | * @return {nlobjSearchColumn} 537 | * @since 2010.1 538 | */ 539 | nlobjSearchColumn.prototype.setSort = function(order) { 540 | }; 541 | 542 | /** 543 | * Returns the search column for which the minimal or maximal value should be found when 544 | * returning the nlobjSearchColumn value 545 | * For example, can be set to find the most recent or earliest date, or the largest or smallest 546 | * amount for a record, and then the nlobjSearchColumn value for that record is returned 547 | * Can only be used when min or max is passed as the summary parameter in the 548 | * nlobjSearchColumn constructor 549 | * 550 | * @param {string} name The name of the search column for which the minimal or maximal 551 | * @param {string} join The join id for this search column 552 | * 553 | * @return {nlobjSearchColumn} 554 | * @since 2012.1 555 | */ 556 | nlobjSearchColumn.prototype.setWhenOrderedBy = function(name, join) { 557 | }; 558 | 559 | /** 560 | * Return a new instance of nlobjSearchFilter filter objects used to define search criteria 561 | * 562 | * @constructor 563 | * 564 | * @param {string} name filter name 565 | * @param {string} join internal ID for joined search where this filter is defined 566 | * @param {string} operator operator name. Any of: 567 | * after anyof before 568 | * between contains doesnotcontain 569 | * doesnotstartwith equalto greaterthan 570 | * greaterthanorequalto haskeywords is 571 | * isempty isnot isnotempty 572 | * lessthan lessthanorequalto noneof 573 | * notafter notbefore notbetween 574 | * notequalto notgreaterthan notgreaterthanorequalto 575 | * notlessthan notlessthanorequalto noton 576 | * notonorafter notonorbefore notwithin 577 | * on onorafter onorbefore 578 | * startswith within 579 | * 580 | * @param {string, Date|string[]|int} [value1] 581 | * @param {string, Date} [value2] 582 | * 583 | * @since 2007.0 584 | */ 585 | function nlobjSearchFilter(name, join, operator, value1, value2) { 586 | } 587 | 588 | /** 589 | * Returns the formula used for this filter 590 | * 591 | * @return {string} 592 | * @since 2011.1 593 | */ 594 | nlobjSearchFilter.prototype.getFormula = function() { 595 | }; 596 | 597 | /** 598 | * Sets the formula used for this filter. 599 | * 600 | * @param {string} formula The formula used for this filter 601 | * 602 | * @return {nlobjSearchFilter} 603 | * @since 2011.1 604 | */ 605 | nlobjSearchFilter.prototype.setFormula = function(formula) { 606 | }; 607 | 608 | /** 609 | * Return the name of this search filter 610 | * 611 | * @return {string} 612 | * @since 2007.0 613 | */ 614 | nlobjSearchFilter.prototype.getName = function() { 615 | }; 616 | 617 | /** 618 | * Return the join id for this search filter 619 | * 620 | * @return {string} 621 | * @since 2008.1 622 | */ 623 | nlobjSearchFilter.prototype.getJoin = function() { 624 | }; 625 | 626 | /** 627 | * Return the filter operator used 628 | * 629 | * @return {string} 630 | * @since 2008.2 631 | */ 632 | nlobjSearchFilter.prototype.getOperator = function() { 633 | }; 634 | 635 | /** 636 | * Returns the summary type used for this filter 637 | * 638 | * @return {string} 639 | * @since 2011.1 640 | */ 641 | nlobjSearchFilter.prototype.getSummaryType = function() { 642 | }; 643 | 644 | /** 645 | * @param {string} type The summary type used for this filter. 646 | * In your script, use one of the following summary type IDs: 647 | * Summary type ID (used in script) Summary Label (as seen in UI) 648 | * ----------------------------------------|---------------------------------------------------------- 649 | * max Maximum 650 | * min MinimumSuiteScript Objects 651 | * avg Average (only valid for numeric or currency fields) 652 | * sum Sum (only valid for numeric or currency fields) 653 | * count Count 654 | * 655 | * @return {nlobjSearchFilter} 656 | * @since 2011.1 657 | */ 658 | nlobjSearchFilter.prototype.setSummaryType = function(type) { 659 | }; 660 | 661 | /** 662 | * Class definition for interacting with the results of a search operation 663 | * Return a new instance of nlobjSearchResult used for search result row object 664 | * 665 | * @constructor 666 | */ 667 | function nlobjSearchResult() { 668 | } 669 | 670 | /** 671 | * Return the internalId for the record returned in this row 672 | * 673 | * @return {int} 674 | */ 675 | nlobjSearchResult.prototype.getId = function() { 676 | }; 677 | 678 | /** 679 | * Return the recordtype for the record returned in this row 680 | * 681 | * @return {string} 682 | */ 683 | nlobjSearchResult.prototype.getRecordType = function() { 684 | }; 685 | 686 | /** 687 | * Return the value for a return column specified by name, join ID, and summary type 688 | * 689 | * @param {nlobjSearchColumn|string} columnOrName search result column or the name of the search column 690 | * @param {string} [join] the join ID for the search column 691 | * @param {string} [summary] summary type specified for this column 692 | * 693 | * @return {string} 694 | * @since 2008.1 695 | */ 696 | nlobjSearchResult.prototype.getValue = function(columnOrName, join, summary) { 697 | }; 698 | 699 | /** 700 | * Return the text value of this return column if it's a select field 701 | * 702 | * @param {nlobjSearchColumn|string} columnOrName search result column or the name of the search column 703 | * @param {string} [join] the join ID for the search column 704 | * @param {string} [summary] summary type specified for this column 705 | * 706 | * @return {string} 707 | * @since 2008.1 708 | */ 709 | nlobjSearchResult.prototype.getText = function(columnOrName, join, summary) { 710 | }; 711 | 712 | /** 713 | * Return an array of all nlobjSearchColumn objects returned in this search 714 | * 715 | * @return {nlobjSearchColumn[]} 716 | * @since 2009.2 717 | */ 718 | nlobjSearchResult.prototype.getAllColumns = function() { 719 | }; 720 | 721 | /** 722 | * Primary object used to encapsulate a set of search results. 723 | * The nlobjSearchResultSet object provides both an iterator interface, which allows you to process 724 | * each result of the search, and stop at any time, and a slice interface, which allows you to 725 | * retrieve an arbitrary segment of the search results, up to 1000 results at a time. 726 | */ 727 | function nlobjSearchResultSet() { 728 | } 729 | 730 | /** 731 | * Calls the developer-defined callback function for every result in this set. 732 | * 733 | * There is a limit of 4000 rows in the result set returned in forEachResult(). 734 | * Your callback function must have the following signature: boolean callback(nlobjSearchResult result); 735 | * 736 | * Note that the work done in the context of the callback function counts towards the 737 | * governance of the script that called it. For example, if the callback function is running in the context of 738 | * a scheduled script, which has a 10,000 unit governance limit, you must be sure the amount of processing within 739 | * the callback function does not put the entire script at risk of exceeding scheduled script governance limits. 740 | * 741 | * @governance 10 units 742 | * 743 | * @param {function} callback 744 | * 745 | * @return {void} 746 | * @since 2012.1 747 | */ 748 | nlobjSearchResultSet.prototype.forEachResult = function(callback) { 749 | }; 750 | 751 | /** 752 | * Returns a list of nlobjSearchColumn objects for this result set. 753 | * 754 | * This list contains one nlobjSearchColumn object for each result column in the 755 | * nlobjSearchResult objects returned by this search. 756 | * 757 | * @return {nlobjSearchColumn[]} 758 | * @since 2012.1 759 | */ 760 | nlobjSearchResultSet.prototype.getColumns = function() { 761 | }; 762 | 763 | /** 764 | * Retrieve a slice of the search result. 765 | * 766 | * @param {int} start The inclusive index of the first result to return 767 | * @param {int} end The exclusive index of the last result to return 768 | * 769 | * @return {nlobjSearchResult[]} 770 | * @exception {SSS_INVALID_SEARCH_RESULT_INDEX} if start is negative 771 | * @exception {SSS_SEARCH_RESULT_LIMIT_EXCEEDED} if more than 1000 rows are requested 772 | * @since 2012.1 773 | */ 774 | nlobjSearchResultSet.prototype.getResults = function(start, end) { 775 | }; 776 | -------------------------------------------------------------------------------- /sublist.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SuiteScript Sublist APIs 3 | * 4 | * Sublists contain a list of references to other records. Note that the list of record references are referred 5 | * to as line items. Within NetSuite there are four types of sublists: editor, inline editor, list, and static list. 6 | */ 7 | 8 | 9 | /** 10 | * Cancel any changes made on the currently selected line 11 | * @restriction Only supported for sublists of type inlineeditor and editor 12 | * 13 | * @param {string} type sublist name 14 | * @return {void} 15 | * @since 2005.0 16 | */ 17 | function nlapiCancelLineItem(type) { 18 | } 19 | 20 | /** 21 | * Save changes made on the currently selected line to the sublist 22 | * 23 | * @param {string} type sublist name 24 | * @return {void} 25 | * @since 2005.0 26 | */ 27 | function nlapiCommitLineItem(type) { 28 | } 29 | 30 | /** 31 | * Sets the given line item field of a sublist to disabled or enabled 32 | * 33 | * @param {string} type The sublist internal ID (for example, use addressbook as the ID for the Address sublist) 34 | * @param {string} fieldName The name of the line item field to enable/disable 35 | * @param {boolean} value If set to true the field is disabled. If set to false it is enabled 36 | * 37 | * @return {void} 38 | */ 39 | function nlapiDisableLineItemField(type, fieldName, value) { 40 | } 41 | 42 | /** 43 | * Return the 1st line number that a matrix field value appears in 44 | * 45 | * @param {string} type sublist name 46 | * @param {string} fieldName matrix field name 47 | * @param {int} column matrix column index (1-based) 48 | * @param {string} val the value being queried for in a matrix field 49 | * @return {int} 50 | * @since 2009.2 51 | */ 52 | function nlapiFindLineItemMatrixValue(type, fieldName, column, val) { 53 | } 54 | 55 | /** 56 | * Return the 1st line number that a sublist field value appears in 57 | * 58 | * @param {string} type sublist name 59 | * @param {string} fieldName sublist field name 60 | * @param {string} val the value being queried for in a sublist field 61 | * @return {int} 62 | * @since 2009.2 63 | */ 64 | function nlapiFindLineItemValue(type, fieldName, val) { 65 | } 66 | 67 | /** 68 | * Return the value of a field on the currently selected line 69 | * 70 | * @param {string} type sublist name 71 | * @param {string} fieldName sublist field name 72 | * @param {string} [timezone] value 73 | * 74 | * @return {string} 75 | * @since 2013.2 76 | */ 77 | function nlapiGetCurrentLineItemDateTimeValue(type, fieldName, timezone) { 78 | } 79 | 80 | /** 81 | * Return the line number for the currently selected line 82 | * 83 | * @param {string} type sublist name 84 | * 85 | * @return {int} 86 | * @since 2005.0 87 | */ 88 | function nlapiGetCurrentLineItemIndex(type) { 89 | } 90 | 91 | /** 92 | * Get the current value of a sublist field on the current record on a page 93 | * @restriction supported in client and user event scripts only 94 | * @param {string} type sublist name 95 | * @param {string} fieldName sublist field name 96 | * @param {int} column matrix column index (1-based) 97 | * @return {string} value 98 | * @since 2009.2 99 | */ 100 | function nlapiGetCurrentLineItemMatrixValue(type, fieldName, column) { 101 | } 102 | 103 | /** 104 | * Return the label of a select field's current selection on the currently selected line 105 | * 106 | * @param {string} type sublist name 107 | * @param {string} fieldName sublist field name 108 | * 109 | * @return {string} 110 | * @since 2005.0 111 | */ 112 | function nlapiGetCurrentLineItemText(type, fieldName) { 113 | } 114 | 115 | /** 116 | * Return the value of a field on the currently selected line 117 | * 118 | * @param {string} type sublist name 119 | * @param {string} fieldName sublist field name 120 | * @return {string} 121 | * @since 2005.0 122 | */ 123 | function nlapiGetCurrentLineItemValue(type, fieldName) { 124 | } 125 | 126 | /** 127 | * Returns the values of a multiselect sublist field on the currently selected line. 128 | * One example of a multiselect sublist field is the Serial Numbers field on the Items sublist. 129 | * 130 | * This function is not supported in client SuiteScript. It is meant to be used in user event scripts. 131 | * 132 | * @param {string} type The sublist internal ID (for example, use addressbook as the ID for the Address sublist) 133 | * @param {string} fieldName The name of the multiselect field 134 | * 135 | * @return {string[]} 136 | * @since 2012.1 137 | */ 138 | function nlapiGetCurrentLineItemValues(type, fieldName) { 139 | } 140 | 141 | /** 142 | * Return the number of sublists in a sublist on the current record on a page 143 | * 144 | * @restriction supported in client and user event scripts only 145 | * 146 | * @param {string} type sublist name 147 | * @return {int} 148 | * @since 2005.0 149 | */ 150 | function nlapiGetLineItemCount(type) { 151 | } 152 | 153 | /** 154 | * Return the value of a sublist field on the current record on a page 155 | * @restriction supported in client and user event scripts only 156 | * @param {string} type sublist name 157 | * @param {string} fieldName sublist field name 158 | * @param {int} linenum line number (1-based) 159 | * @param {string} [timezone] value 160 | * @return {string} 161 | * @since 2013.2 162 | */ 163 | function nlapiGetLineItemDateTimeValue(type, fieldName, linenum, timezone) { 164 | } 165 | 166 | /** 167 | * Return field definition for a sublist field 168 | * 169 | * @param {string} type sublist name 170 | * @param {string} fieldName sublist field name 171 | * @param {int} [linenum] line number for sublist field (1-based) and only valid for sublists of type staticlist and list 172 | * 173 | * @return {nlobjField} 174 | * @since 2009.1 175 | */ 176 | function nlapiGetLineItemField(type, fieldName, linenum) { 177 | } 178 | 179 | /** 180 | * Return an nlobjField containing sublist field metadata 181 | * 182 | * @param {string} type matrix sublist name 183 | * @param {string} fieldName matrix field name 184 | * @param {int} linenum line number (1-based) 185 | * @param {int} column matrix column index (1-based) 186 | * 187 | * @return {nlobjField} 188 | * @since 2009.2 189 | */ 190 | function nlapiGetLineItemMatrixField(type, fieldName, linenum, column) { 191 | } 192 | 193 | /** 194 | * Return the value of a sublist matrix field on the current record on a page 195 | * @restriction supported in client and user event scripts only 196 | * @param {string} type sublist name 197 | * @param {string} fieldName sublist field name 198 | * @param {int} linenum line number (1-based) 199 | * @param {int} column column index (1-based) 200 | * 201 | * @return {string} value 202 | * @since 2009.2 203 | */ 204 | function nlapiGetLineItemMatrixValue(type, fieldName, linenum, column) { 205 | } 206 | 207 | /** 208 | * Return the label of a select field's current selection for a particular line 209 | * 210 | * @param {string} type sublist name 211 | * @param {string} fieldName sublist field name 212 | * @param {int} linenum line number (1-based) 213 | * @return {string} 214 | * @since 2005.0 215 | */ 216 | function nlapiGetLineItemText(type, fieldName, linenum) { 217 | } 218 | 219 | /** 220 | * Return the value of a sublist field on the current record on a page 221 | * @restriction supported in client and user event scripts only 222 | * @param {string} type sublist name 223 | * @param {string} fieldName sublist field name 224 | * @param {int} linenum line number (1-based) 225 | * @return {string} 226 | * @since 2005.0 227 | */ 228 | function nlapiGetLineItemValue(type, fieldName, linenum) { 229 | } 230 | 231 | /** 232 | * Returns the values of a multiselect sublist field on a selected line. One example of a multiselect 233 | * Sublist field is the Serial Numbers field on the Items sublist 234 | * @restriction supported in client scripts only 235 | * @param {string} type sublist name 236 | * @param {string} fieldName sublist field name 237 | * @param {int} linenum line number (1-based) 238 | * @return {string[]} An array of string values for the multiselect sublist field 239 | * @since 2012.1 240 | */ 241 | function nlapiGetLineItemValues(type, fieldName, linenum) { 242 | } 243 | 244 | /** 245 | * Return sublist field mandatoriness 246 | * 247 | * @restriction Only supported on sublists of type inlineeditor or editor (current field only) 248 | * 249 | * @param {string} type sublist name 250 | * @param {string} fieldName sublist field name 251 | * 252 | * @return {boolean} 253 | * @since 2009.1 254 | */ 255 | function nlapiGetLineItemMandatory(type, fieldName) { 256 | } 257 | 258 | /** 259 | * Return the number of columns for a matrix field 260 | * 261 | * @param {string} type sublist name 262 | * @param {string} fieldName matrix field name 263 | * @return {int} 264 | * @since 2009.2 265 | */ 266 | function nlapiGetMatrixCount(type, fieldName) { 267 | } 268 | 269 | /** 270 | * Return field definition for a matrix field 271 | * 272 | * @param {string} type matrix sublist name 273 | * @param {string} fieldName matrix field name 274 | * @param {int} column matrix field column index (1-based) 275 | * 276 | * @return {nlobjField} 277 | * @since 2009.2 278 | */ 279 | function nlapiGetMatrixField(type, fieldName, column) { 280 | } 281 | 282 | /** 283 | * Get the value of a matrix header field 284 | * 285 | * @param {string} type sublist name 286 | * @param {string} fieldName sublist field name 287 | * @param {int} column matrix column index (1-based) 288 | * 289 | * @return {string} 290 | * @since 2009.2 291 | */ 292 | function nlapiGetMatrixValue(type, fieldName, column) { 293 | } 294 | 295 | /** 296 | * Insert and select a new line into the sublist on a page or userevent 297 | * Available to client and user event scripts only 298 | * 299 | * @param {string} type sublist name 300 | * @param {int} [line] line number at which to insert a new line 301 | * @return{void} 302 | * @since 2005.0 303 | */ 304 | function nlapiInsertLineItem(type, line) { 305 | } 306 | 307 | /** 308 | * Adds a select option to a scripted select or multiselect sublist field 309 | * 310 | * @restriction Client SuiteScript only 311 | * 312 | * @param {string} type sublist name 313 | * @param {string} fieldName sublist field name 314 | * @param {string} value internal ID for select option 315 | * @param {string} text display text for select option 316 | * @param {boolean} [selected] if true then option will be selected by default 317 | * 318 | * @return {void} 319 | * @since 2008.2 320 | */ 321 | function nlapiInsertLineItemOption(type, fieldName, value, text, selected) { 322 | } 323 | 324 | /** 325 | * Returns true if any changes have been made to a sublist 326 | * 327 | * @restriction Client SuiteScript only 328 | * 329 | * @param {string} type sublist name 330 | * 331 | * @return {boolean} 332 | * @since 2005.0 333 | */ 334 | function nlapiIsLineItemChanged(type) { 335 | } 336 | 337 | /** 338 | * Refresh the sublist table 339 | * 340 | * @restriction Only supported for sublists of type inlineeditor, editor, and staticlist 341 | * @restriction Client SuiteScript only 342 | * 343 | * @param {string} type sublist name 344 | * @return{void} 345 | * @since 2005.0 346 | */ 347 | function nlapiRefreshLineItems(type) { 348 | } 349 | 350 | /** 351 | * Remove the currently selected line from the sublist on a page or userevent 352 | * 353 | * @param {string} type sublist name 354 | * @param {int} [line] line number to remove 355 | * @return {void} 356 | * @since 2005.0 357 | */ 358 | function nlapiRemoveLineItem(type, line) { 359 | } 360 | 361 | /** 362 | * Removes a select option (or all if value is null) from a scripted select or multiselect sublist field 363 | * 364 | * @restriction Client SuiteScript only 365 | * 366 | * @param {string} type sublist name 367 | * @param {string} fieldName sublist field name 368 | * @param {string} value internal ID for select option to remove 369 | * 370 | * @return {void} 371 | * @since 2008.2 372 | */ 373 | function nlapiRemoveLineItemOption(type, fieldName, value) { 374 | } 375 | 376 | /** 377 | * Select an existing line in a sublist 378 | * 379 | * @param {string} type sublist name 380 | * @param {int} linenum line number to select 381 | * @return {void} 382 | * @since 2005.0 383 | */ 384 | function nlapiSelectLineItem(type, linenum) { 385 | } 386 | 387 | /** 388 | * Select a new line in a sublist 389 | * 390 | * @restriction Only supported for sublists of type inlineeditor and editor 391 | * 392 | * @param {string} type sublist name 393 | * @return {void} 394 | * @since 2005.0 395 | */ 396 | function nlapiSelectNewLineItem(type) { 397 | } 398 | 399 | /** 400 | * Set the value of a field on the currently selected line 401 | * @restriction synchronous arg is only supported in client SuiteScript 402 | * 403 | * @param {string} type sublist name 404 | * @param {string} fieldName sublist field name 405 | * @param {string} value field value 406 | * @param {string} [timezone] value 407 | * @return {void} 408 | * @since 2013.2 409 | */ 410 | function nlapiSetCurrentLineItemDateTimeValue(type, fieldName, value, timezone) { 411 | } 412 | 413 | /** 414 | * Set the current value of a sublist field on the current record on a page 415 | * 416 | * @restriction supported in client and user event scripts only 417 | * @restriction synchronous arg is only supported in Client SuiteScript 418 | * 419 | * @param {string} type sublist name 420 | * @param {string} fieldName sublist field name 421 | * @param {int} column matrix column index (1-based) 422 | * @param {string} value matrix field value 423 | * @param {boolean} [fireFieldChanged=true] if false then the field change event is suppressed 424 | * @param {boolean} [synchronous=false] if true then sourcing and field change execution happens synchronously 425 | * 426 | * @return {void} 427 | * @since 2009.2 428 | */ 429 | function nlapiSetCurrentLineItemMatrixValue(type, fieldName, column, value, fireFieldChanged, synchronous) { 430 | } 431 | 432 | /** 433 | * Set the value of a field on the currently selected line using it's label 434 | * @restriction synchronous arg is only supported in client SuiteScript 435 | * 436 | * @param {string} type sublist name 437 | * @param {string} fieldName sublist field name 438 | * @param {string} txt string containing display value or search text 439 | * @param {boolean} [fireFieldChanged=true] if false then the field change event is suppressed 440 | * @param {boolean} [synchronous=false] if true then sourcing and field change execution happens synchronously 441 | * @return {void} 442 | * @since 2005.0 443 | */ 444 | function nlapiSetCurrentLineItemText(type, fieldName, txt, fireFieldChanged, synchronous) { 445 | } 446 | 447 | /** 448 | * Set the value of a field on the currently selected line 449 | * @restriction synchronous arg is only supported in client SuiteScript 450 | * 451 | * @param {string} type sublist name 452 | * @param {string} fieldName sublist field name 453 | * @param {string} value field value 454 | * @param {boolean} [fireFieldChanged=true] If false then the field change event is suppressed 455 | * @param {boolean} [synchronous=false] if true then sourcing and field change execution happens synchronously 456 | * 457 | * @return {void} 458 | * @since 2005.0 459 | */ 460 | function nlapiSetCurrentLineItemValue(type, fieldName, value, fireFieldChanged, synchronous) { 461 | } 462 | 463 | /** 464 | * Sets the values for a multi-select sublist field. 465 | * 466 | * Note that like any other “set field” APIs, the values you use will be internal ID values. 467 | * For example, rather than specifying 'Abe Simpson' as a customer value, you will use 232 or 88 or whatever 468 | * the internal ID is for customer Abe Simpson. 469 | * 470 | * However, if you are using this API to set the serialnumber field on the Item sublist, 471 | * you will set the text string of the actual serial number, for example 'serialnum1', 'serialnum2', and so on. 472 | * 473 | * This API is supported in client scripts only. 474 | * 475 | * @param {string} type The sublist internal ID (for example, use addressbook as the ID for the Address sublist) 476 | * @param {string} fieldName The name of the multi-select sublist field being set 477 | * @param {string[]} values The values for the field 478 | * @param {boolean} [fireFieldChanged=true] If false then the field change event is suppressed 479 | * @param {boolean} [synchronous=false] if true then sourcing and field change execution happens synchronously 480 | * 481 | * @return {void} 482 | * @since 2012.1 483 | */ 484 | function nlapiSetCurrentLineItemValues(type, fieldName, values, fireFieldChanged, synchronous) { 485 | } 486 | 487 | /** 488 | * Set the value of a sublist field on the current record on a page 489 | * @restriction supported in client and user event scripts only 490 | * @param {string} type sublist name 491 | * @param {string} fieldName sublist field name 492 | * @param {int} linenum line number (1-based) 493 | * @param {string} value datetime value 494 | * @param {string} [timezone] value 495 | * @return {void} 496 | * @since 2013.2 497 | */ 498 | function nlapiSetLineItemDateTimeValue(type, fieldName, linenum, value, timezone) { 499 | } 500 | 501 | /** 502 | * Disable a sublist field 503 | * 504 | * @restriction Only supported on sublists of type inlineeditor, editor and list (current field only) 505 | * 506 | * @param {string} type sublist name 507 | * @param {string} fieldName sublist field name 508 | * @param {boolean} disable if true then field is disabled 509 | * @param {int} linenum line number for sublist field (1-based) and only valid for sublists of type list 510 | * 511 | * @return {void} 512 | * @since 2009.1 513 | */ 514 | function nlapiSetLineItemDisabled(type, fieldName, disable, linenum) { 515 | } 516 | 517 | /** 518 | * Make a sublist field mandatory 519 | * 520 | * @restriction Only supported on sublists of type inlineeditor or editor (current field only) 521 | * 522 | * @param {string} type sublist name 523 | * @param {string} fieldName sublist field name 524 | * @param {boolean} mandatory if true then field is made mandatory 525 | * @return {void} 526 | * @since 2009.2 527 | */ 528 | function nlapiSetLineItemMandatory(type, fieldName, mandatory) { 529 | } 530 | 531 | /** 532 | * Set the value of a sublist field on the current record on a page 533 | * @restriction supported in client and user event scripts only 534 | * @param {string} type sublist name 535 | * @param {string} fieldName sublist field name 536 | * @param {int} linenum line number (1-based) 537 | * @param {string} value 538 | * @return {void} 539 | * @since 2005.0 540 | */ 541 | function nlapiSetLineItemValue(type, fieldName, linenum, value) { 542 | } 543 | 544 | /** 545 | * Set the value of a matrix header field 546 | * 547 | * @restriction synchronous arg is only supported in client SuiteScript 548 | * 549 | * @param {string} type sublist name 550 | * @param {string} fieldName sublist field name 551 | * @param {int} column matrix column index (1-based) 552 | * @param {string} value field value for matrix field 553 | * @param {boolean} [fireFieldChanged=true] if false then the field change event is suppressed 554 | * @param {boolean} [synchronous=false] if true then sourcing and field change execution happens synchronously 555 | * 556 | * @return {void} 557 | * @since 2009.2 558 | */ 559 | function nlapiSetMatrixValue(type, fieldName, column, value, fireFieldChanged, synchronous) { 560 | } 561 | 562 | /** 563 | * Primary object used to encapsulate a NetSuite sublist. 564 | * 565 | * This object is read-only except for instances created via the UI Object API using Suitelets 566 | * or beforeLoad user event scripts. 567 | * To add a sublist, you must first create a custom form using nlapiCreateForm(title, hideNavbar), 568 | * which returns an nlobjForm object. 569 | * Once the form object is instantiated, you can add a new sublist to the form using the 570 | * nlobjForm.addSubList(name, type, label, tab) method, which returns a reference to nlobSublist. 571 | * 572 | * @constructor 573 | */ 574 | function nlobjSubList() { 575 | } 576 | 577 | /** 578 | * Set the label for this sublist 579 | * This method is only supported on sublists via the UI Object API 580 | * 581 | * @param {string} label 582 | * @since 2008.2 583 | */ 584 | nlobjSubList.prototype.setLabel = function(label) { 585 | }; 586 | 587 | /** 588 | * Set helper text for this sublist 589 | * This method is only supported on sublists via the UI Object API 590 | * 591 | * @param {string} help 592 | * @since 2008.2 593 | */ 594 | nlobjSubList.prototype.setHelpText = function(help) { 595 | }; 596 | 597 | /** 598 | * 599 | * @param field 600 | */ 601 | nlobjSubList.prototype.setAmountField = function(field) { 602 | }; 603 | 604 | /** 605 | * Set the display type for this sublist: hidden|normal 606 | * This method is only supported on scripted or staticlist sublists via the UI Object API 607 | * 608 | * @param {string} type 609 | * @since 2008.2 610 | */ 611 | nlobjSubList.prototype.setDisplayType = function(type) { 612 | }; 613 | 614 | /** 615 | * Set the value of a cell in this sublist 616 | * 617 | * @param {string} field sublist field name 618 | * @param {int} line line number (1-based) 619 | * @param {string} value sublist value 620 | * @since 2008.2 621 | */ 622 | nlobjSubList.prototype.setLineItemValue = function(field, line, value) { 623 | }; 624 | 625 | /** 626 | * Set the value of a matrix cell in this sublist 627 | * @param {string} field matrix field name 628 | * @param {int} line line number (1-based) 629 | * @param {int} column matrix column index (1-based) 630 | * @param {string} value matrix field value 631 | * @return {void} 632 | * @since 2009.2 633 | */ 634 | nlobjSubList.prototype.setLineItemMatrixValue = function(field, line, column, value) { 635 | }; 636 | 637 | /** 638 | * Set values for multiple lines (Array of nlobjSearchResults or name-value pair Arrays) in this sublist 639 | * Note that this method is only supported on scripted sublists via the UI Object API 640 | * 641 | * @param {string[][], nlobjSearchResult[]} values 642 | * @since 2008.2 643 | */ 644 | nlobjSubList.prototype.setLineItemValues = function(values) { 645 | }; 646 | 647 | /** 648 | * Return the number of lines in a sublist 649 | * 650 | * @param {string} group sublist name 651 | * 652 | * @since 2010.1 653 | */ 654 | nlobjSubList.prototype.getLineItemCount = function(group) { 655 | }; 656 | 657 | /** 658 | * @since 2010.1 659 | */ 660 | nlobjSubList.prototype.getLineItemValue = function() { 661 | }; 662 | 663 | /** 664 | * Add a field (column) to this sublist 665 | * 666 | * @param {string} name field name 667 | * @param {string} type field type 668 | * @param {string} label field label 669 | * @param {string, int} [source] script ID or internal ID for source list used for this select field 670 | * @return {nlobjField} 671 | * @since 2008.2 672 | */ 673 | nlobjSubList.prototype.addField = function(name, type, label, source) { 674 | }; 675 | 676 | /** 677 | * designate a field on sublist that must be unique across all lines (only supported on sublists of type inlineeditor, editor) 678 | * @param {string} fieldName the name of a field on this sublist whose value must be unique across all lines 679 | * @return {nlobjField} 680 | * @since 2009.2 681 | */ 682 | nlobjSubList.prototype.setUniqueField = function(fieldName) { 683 | }; 684 | 685 | /** 686 | * Add a button to this sublist 687 | * 688 | * @param {string} name button name 689 | * @param {string} label button label 690 | * @param {string} script button script (function name) 691 | * @return {nlobjButton} 692 | * @since 2008.2 693 | */ 694 | nlobjSubList.prototype.addButton = function(name, label, script) { 695 | }; 696 | 697 | /** 698 | * Add "Refresh" button to sublists of type "staticlist" to support manual refreshing of the sublist (without entire page reloads) if it's contents are very volatile 699 | * @return {nlobjButton} 700 | * @since 2009.2 701 | */ 702 | nlobjSubList.prototype.addRefreshButton = function() { 703 | }; 704 | 705 | /** 706 | * Add "Mark All" and "Un-mark All" buttons to this sublist of type "list" 707 | * @since 2008.2 708 | */ 709 | nlobjSubList.prototype.addMarkAllButtons = function() { 710 | }; 711 | -------------------------------------------------------------------------------- /subrecord.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SuiteScript Subrecord APIs 3 | * 4 | * The subrecord APIs that contain “LineItem” are for creating and working with subrecords from a sublist field 5 | * on the parent record. The APIs that do not have “LineItem” in the name are for creating and working 6 | * with subrecords from a body field on the parent record. 7 | * 8 | * Note that most of the functions listed below return an nlobjSubrecord object. After creating or editing a subrecord, 9 | * you must save your changes using the nlobjSubrecord.commit() method. You must then save the subrecord’s parent 10 | * record using nlapiSubmitRecord(record, doSourcing, ignoreMandatoryFields). If you do not commit both the subrecord 11 | * and the parent record, all changes to the subrecord are lost. 12 | * 13 | * Important: Subrecords are used in the context of the Advanced Bin / Numbered Inventory Management feature. 14 | * Currently, the only supported subrecord in NetSuite is the Inventory Details subrecord. 15 | */ 16 | 17 | 18 | /** 19 | * Create a subrecord on body field on the current record on a page 20 | * 21 | * @restriction supported in client and user event scripts only 22 | * 23 | * @param {string} fieldName body field name 24 | * 25 | * @return {nlobjSubrecord} 26 | * @since 2011.2 27 | */ 28 | function nlapiCreateSubrecord(fieldName) { 29 | } 30 | 31 | /** 32 | * Edit a subrecord on body field on the current record on a page 33 | * 34 | * @restriction supported in client and user event scripts only 35 | * 36 | * @param {string} fieldName body field name 37 | * 38 | * @return {nlobjSubrecord} 39 | * @since 2011.2 40 | */ 41 | function nlapiEditSubrecord(fieldName) { 42 | } 43 | 44 | /** 45 | * Remove a subrecord on body field on the current record on a page 46 | * 47 | * @restriction supported in client and user event scripts only 48 | * 49 | * @param {string} fieldName body field name 50 | * 51 | * @return {void} 52 | * @since 2011.2 53 | */ 54 | function nlapiRemoveSubrecord(fieldName) { 55 | } 56 | 57 | /** 58 | * view a subrecord on body field on the current record on a page 59 | * @restriction supported in client and user event scripts only 60 | * @param {string} fieldName body field name 61 | * @return {nlobjSubrecord} 62 | * @since 2011.2 63 | */ 64 | function nlapiViewSubrecord(fieldName) { 65 | } 66 | 67 | /** 68 | * Create a subrecord on a sublist field on the current record on a page 69 | * @restriction supported in client and user event scripts only 70 | * @param {string} type sublist name 71 | * @param {string} fieldName sublist field name 72 | * @return {nlobjSubrecord} 73 | * @since 2011.2 74 | */ 75 | function nlapiCreateCurrentLineSubrecord(type, fieldName) { 76 | } 77 | 78 | /** 79 | * view a subrecord on a sublist field on the current record on a page 80 | * @restriction supported in client and user event scripts only 81 | * @param {string} type sublist name 82 | * @param {string} fieldName sublist field name 83 | * @return {nlobjSubrecord} 84 | * @since 2011.2 85 | */ 86 | function nlapiViewCurrentLineItemSubrecord(type, fieldName) { 87 | } 88 | 89 | /** 90 | * Edit a subrecord on a sublist field on the current record on a page 91 | * @restriction supported in client and user event scripts only 92 | * @param {string} type sublist name 93 | * @param {string} fieldName sublist field name 94 | * @return {nlobjSubrecord} 95 | * @since 2011.2 96 | */ 97 | function nlapiEditCurrentLineItemSubrecord(type, fieldName) { 98 | } 99 | 100 | /** 101 | * Remove a subrecord on a sublist field on the current record on a page 102 | * @restriction supported in client and user event scripts only 103 | * @param {string} type sublist name 104 | * @param {string} fieldName sublist field name 105 | * @return {void} 106 | * @since 2011.2 107 | */ 108 | function nlapiRemoveCurrentLineItemSubrecord(type, fieldName) { 109 | } 110 | 111 | /** 112 | * view a subrecord on a sublist field on the current record on a page 113 | * @restriction supported in client and user event scripts only 114 | * @param {string} type sublist name 115 | * @param {string} fieldName sublist field name 116 | * @param {int} linenum line number (1-based) 117 | * @return {nlobjSubrecord} 118 | * @since 2011.2 119 | */ 120 | function nlapiViewLineItemSubrecord(type, fieldName, linenum) { 121 | } 122 | 123 | /** 124 | * Primary object used to encapsulate a NetSuite subrecord 125 | * 126 | * To create a subrecord, you must first create or load a parent record. You can then create or access a subrecord 127 | * from a body field or from a sublist field on the parent record 128 | * 129 | * Important: Subrecords are currently supported only in the context of the new Advanced Bin / Numbered Inventory 130 | * Management feature 131 | */ 132 | function nlobjSubrecord() { 133 | } 134 | 135 | /** 136 | * Commit the subrecord after you finish modifying it 137 | * 138 | * @return {void} 139 | * @since 2008.1 140 | */ 141 | nlobjSubrecord.prototype.commit = function() { 142 | }; 143 | 144 | /** 145 | * Cancel the any modification on subrecord 146 | * 147 | * Use this method to cancel the current processing of the subrecord and revert subrecord data to 148 | * the last committed change (submitted in the last commit() call) 149 | * 150 | * Note that you will not be able to do any additional write or read operations on the subrecord 151 | * Instance after you have canceled it. You must reload the subrecord from the parent to write any 152 | * Additional data to the subrecord 153 | * 154 | * @return {void} 155 | * @since 2008.1 156 | */ 157 | nlobjSubrecord.prototype.cancel = function() { 158 | }; 159 | -------------------------------------------------------------------------------- /suiteFlow.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SuiteScript SuiteFlow APIs 3 | * 4 | * Use these APIs to interact with the NetSuite SuiteFlow Manager 5 | */ 6 | 7 | 8 | /** 9 | * Initiates a workflow on-demand and returns the workflow instance ID for the workflow-record combination 10 | * 11 | * This API is supported in user event, scheduled, portlet, Suitelet, mass update, and workflow action scripts. 12 | * 13 | * @governance 20 units 14 | * 15 | * @param {string} recordtype record type ID of the workflow base record 16 | * @param {int} id internal ID of the base record 17 | * @param {string, int} workflowid internal ID or script ID for the workflow definition 18 | * 19 | * @return {int} The internal ID of the workflow instance used to track the workflow against the record 20 | * @since 2010.1 21 | */ 22 | function nlapiInitiateWorkflow(recordtype, id, workflowid) { 23 | } 24 | 25 | /** 26 | * Triggers a workflow on a record 27 | * 28 | * The actions and transitions of the workflow will be evaluated for the record based on the current state that it is in. 29 | * This API is supported in user event, scheduled, portlet, Suitelet, mass update, and workflow action scripts. 30 | * 31 | * @governance 20 units 32 | * 33 | * @param {string} recordType record type ID of the workflow base record 34 | * @param {int} id internal ID of the base record 35 | * @param {string, int} workflowid internal ID or script ID for the workflow definition 36 | * @param {string, int} [actionid] internal ID or script ID of the action script 37 | * 38 | * @return {int} The internal ID of the workflow instance used to track the workflow against the record 39 | * @since 2010.1 40 | */ 41 | function nlapiTriggerWorkflow(recordType, id, workflowid, actionid) { 42 | } 43 | -------------------------------------------------------------------------------- /template.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SuiteScript Template APIs 3 | */ 4 | 5 | 6 | /** 7 | * Create a template renderer used to generate various outputs based on a template 8 | * 9 | * @restriction Server SuiteScript only 10 | * @governance 10 units 11 | * 12 | * @param {string} type media type: pdf|html 13 | * @param {string} [engineType] Default is freemarker/html 14 | * @return {nlobjTemplateRenderer} 15 | * 16 | */ 17 | function nlapiCreateTemplateRenderer(type, engineType) { 18 | } 19 | 20 | /** 21 | * This API was deprecated in NetSuite version 2008.1, however, it continues to be supported. 22 | * This function will not be enhanced in future versions of NetSuite. 23 | * 24 | * In its place, users can use nlapiMergeRecord(id, baseType, baseId, altType, altId, fields), 25 | * which performs exactly the same as nlapiMergeTemplate. The only distinction between the two functions 26 | * is that nlapiMergeRecord returns a nlobjFile object (instead of a String). 27 | * 28 | * @param id 29 | * @param baseType 30 | * @param baseId 31 | * @param altType 32 | * @param altId 33 | * @param fields 34 | * 35 | * @deprecated 2008.1 36 | */ 37 | function nlapiMergeTemplate(id, baseType, baseId, altType, altId, fields) { 38 | } 39 | 40 | /** 41 | * Template engine that produces HTML and PDF printed forms utilizing advanced PDF/HTML template capabilities 42 | * 43 | * This object uses FreeMarker syntax to interpret a template passed in as string. 44 | * Interpreted content can be rendered in two different formats: as HTML output to an nlobjResponse object 45 | * or as XML string that can be passed to nlapiXMLToPDF(xmlstring) to produce a PDF. 46 | * 47 | * This object is available when the Advanced PDF/HTML Templates (Beta) feature is enabled. 48 | * Because this feature is a beta version, this API is also considered beta and may be subject to change. 49 | * For information about this feature, see Advanced PDF/HTML Templates (Beta). 50 | * 51 | * Note: The advanced template API expects your template string to conform to FreeMarker syntax. 52 | * FreeMarker documentation is available from this link, or go to: http://freemarker.sourceforge.net/docs/index.html. 53 | * 54 | * Note: As stated above, the nlapiXMLToPDF API can be used to produce a PDF from the string rendered by 55 | * this object's methods. This API is used in conjunction with the Big Faceless Report Generator, 56 | * a third-party library built by Big Faceless Organization (BFO). See nlapiXMLToPDF(xmlstring) 57 | * for links to BFO documentation. 58 | * 59 | * @constructor 60 | */ 61 | function nlobjTemplateRenderer() { 62 | } 63 | 64 | /** 65 | * Add a record for @to a template engine 66 | * 67 | * @param {string} [recordName] name of record used as a reference in template 68 | * @param {nlobjRecord} record to add to template engine 69 | * 70 | * @return {void} 71 | * 72 | */ 73 | nlobjTemplateRenderer.prototype.addRecord = function(recordName, record) { 74 | }; 75 | 76 | /** 77 | * Render the output of the template engine into the response 78 | * @param {nlobjResponse} response 79 | * 80 | * @return {void} 81 | */ 82 | nlobjTemplateRenderer.prototype.renderToResponse = function(response) { 83 | }; 84 | 85 | /** 86 | * Returns template content interpreted by FreeMarker as XML string that can be passed to nlapiXMLToPDF(xmlstring) 87 | * to produce PDF output. 88 | * 89 | * Note: The nlapiXMLToPDF API is used in conjunction with the Big Faceless Report Generator, a third-party 90 | * library built by Big Faceless Organization (BFO). See nlapiXMLToPDF(xmlstring) for links to BFO documentation. 91 | * 92 | * @return {string} XML string of template interpreted by FreeMarker 93 | * @since 2013.1 94 | */ 95 | nlobjTemplateRenderer.prototype.renderToString = function() { 96 | }; 97 | 98 | /** 99 | * Add search results to a template engine 100 | * 101 | * @param {string} [searchName] name of search results used as a reference in template 102 | * @param {nlobjSearchResult[]} [results] An array of nlobjSearchResult objects 103 | * 104 | * @return {void} 105 | * 106 | */ 107 | nlobjTemplateRenderer.prototype.addSearchResults = function(searchName, results) { 108 | }; 109 | 110 | /** 111 | * Set the template xml in the template engine 112 | * @param {string} xml BFO template 113 | * 114 | * @return {void} 115 | */ 116 | nlobjTemplateRenderer.prototype.setTemplate = function(xml) { 117 | }; 118 | -------------------------------------------------------------------------------- /transaction.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | 5 | 6 | /** 7 | * Void a transaction based on type and id 8 | * 9 | * @governance 10 units for transactions 10 | * 11 | * @param {string} type The transaction type name 12 | * @param {string} id The internal ID for the record 13 | * @return {string} if accounting preference is reversing journal, then it is new journal id, 14 | * otherwise, it is the input record id 15 | * @since 2014.1 16 | */ 17 | function nlapiVoidTransaction(type, id) { 18 | } 19 | -------------------------------------------------------------------------------- /userCredentials.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SuiteScript User Credentials APIs 3 | * 4 | * Use these APIs to change the NetSuite login credentials of the currently logged-in user. 5 | * In NetSuite, a user’s login credentials consists of a user’s email address and a password. 6 | * 7 | * Important: When building a custom UI outside of the standard NetSuite UI (such as building 8 | * a custom mobile page using Suitelet or building E-Commerce pages using SSP), 9 | * use these APIs to help users manage their credentials within the custom UI. 10 | */ 11 | 12 | 13 | /** 14 | * Returns the NetSuite login credentials of currently logged-in user. 15 | * This API is supported in user event, portlet, Suitelet, RESTlet, and SSP scripts. 16 | * 17 | * @return {nlobjLogin} 18 | * @since 2012.2 19 | */ 20 | function nlapiGetLogin() { 21 | } 22 | 23 | /** 24 | * Primary object used to encapsulate NetSuite user login credentials. 25 | * 26 | * @constructor 27 | */ 28 | function nlobjLogin() { 29 | } 30 | 31 | /** 32 | * Sets the logged-in user’s email address to a new one. 33 | * 34 | * @param {string} currentPassword current Password 35 | * @param {string} newEmail new Email 36 | * @param {boolean} [justThisAccount=true] Indicates whether to apply email change only to roles within this account 37 | * or apply email change to its all NetSuite accounts and roles 38 | * 39 | * @return {void} 40 | * @since 2012.2 41 | */ 42 | 43 | nlobjLogin.prototype.changeEmail = function(currentPassword, newEmail, justThisAccount) { 44 | }; 45 | 46 | /** 47 | * @param {string} currentPassword current Password 48 | * @param {string} newPassword The new password for the logged-in user. 49 | * If a valid value is not specified, an error will be thrown. 50 | * 51 | * @return {void} 52 | * @since 2012.2 53 | */ 54 | nlobjLogin.prototype.changePassword = function(currentPassword, newPassword) { 55 | }; 56 | -------------------------------------------------------------------------------- /xml.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SuiteScript XML APIs 3 | */ 4 | 5 | 6 | /** 7 | * Escape a string for use in an XML document 8 | * 9 | * @param {string} text string to escape 10 | * 11 | * @return {string} 12 | * @since 2008.1 13 | */ 14 | function nlapiEscapeXML(text) { 15 | } 16 | 17 | /** 18 | * Select a node from an XML node using XPath. Supports custom namespaces 19 | * (nodes in default namespace can be referenced using "nlapi" as the prefix) 20 | * 21 | * @param {Node} node node being queried 22 | * @param {string} xpath string containing XPath expression 23 | * 24 | * @return {Node} 25 | * @since 2008.1 26 | */ 27 | function nlapiSelectNode(node, xpath) { 28 | } 29 | 30 | /** 31 | * Select an array of nodes from an XML node using XPath. Supports custom namespaces 32 | * (nodes in default namespace can be referenced using "nlapi" as the prefix) 33 | * 34 | * @param {Node} node node being queried 35 | * @param {string} xpath string containing XPath expression 36 | * 37 | * @return {Node[]} 38 | * @since 2008.1 39 | */ 40 | function nlapiSelectNodes(node, xpath) { 41 | } 42 | 43 | /** 44 | * Select a value from an XML node using XPath. Supports custom namespaces 45 | * (nodes in default namespace can be referenced using "nlapi" as the prefix) 46 | * 47 | * @param {Node} node node being queried 48 | * @param {string} xpath string containing XPath expression 49 | * @return {string} 50 | * @since 2008.2 51 | */ 52 | function nlapiSelectValue(node, xpath) { 53 | } 54 | 55 | /** 56 | * Select an array of values from an XML node using XPath. Supports custom namespaces 57 | * (nodes in default namespace can be referenced using "nlapi" as the prefix) 58 | * 59 | * @param {Node} node node being queried 60 | * @param {string} xpath string containing XPath expression 61 | * 62 | * @return {string[]} 63 | * @since 2008.1 64 | */ 65 | function nlapiSelectValues(node, xpath) { 66 | } 67 | 68 | /** 69 | * Convert a string into an XML document. 70 | * Note that in Server SuiteScript XML is supported natively by the JS runtime using the e4x standard 71 | * (http://en.wikipedia.org/wiki/E4X) 72 | * This makes scripting XML simpler and more efficient. his API is useful if you want to navigate/query 73 | * a structured XML document more effectively using either the Document API or NetSuite built- in XPath functions. 74 | * 75 | * @param {string} str string being parsed into an XML document 76 | * 77 | * @return {Node} 78 | * @since 2008.1 79 | */ 80 | function nlapiStringToXML(str) { 81 | } 82 | 83 | /** 84 | * Convert an XML document into a string. 85 | * Note that in Server SuiteScript XML is supported natively by the JS runtime using the e4x standard 86 | * (http://en.wikipedia.org/wiki/E4X) 87 | * This makes scripting XML data simpler and more efficient. This API is useful if you want to serialize 88 | * and store a Document in a custom field (for example). 89 | * 90 | * @param {Node} xml document being serialized into a string 91 | * 92 | * @return {string} 93 | * @since 2008.1 94 | */ 95 | function nlapiXMLToString(xml) { 96 | } 97 | 98 | /** 99 | * Validate that a given XML document conforms to a given XML schema. 100 | * XML Schema Definition (XSD) is the expected schema format. 101 | * 102 | * @param {document} xmlDocument xml to validate 103 | * @param {document} schemaDocument schema to enforce 104 | * @param {string} schemaFolderId if your schema utilizes or tags which 105 | * refer to sub-schemas by file name (as opposed to URL), 106 | * provide the Internal Id of File Cabinet folder containing these 107 | * sub-schemas as the schemaFolderId argument 108 | * 109 | * @throws {nlobjError} error containing validation failure message(s) - limited to first 10 110 | * 111 | * @since 2014.1 112 | */ 113 | function nlapiValidateXML(xmlDocument, schemaDocument, schemaFolderId) { 114 | } 115 | 116 | /** 117 | * Generate a PDF from XML using the BFO report writer (see http://big.faceless.org/products/report/) 118 | * 119 | * @restriction Server SuiteScript only 120 | * @governance 10 units 121 | * 122 | * @param {string} input string containing BFO compliant XHTML 123 | * 124 | * @return {nlobjFile} 125 | * @exception {ERROR_PARSING_XML} 126 | * @since 2009.1 127 | */ 128 | function nlapiXMLToPDF(input) { 129 | } 130 | --------------------------------------------------------------------------------