@hitc/netsuite-types 2024.2.5 → 2024.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/N/types.d.ts CHANGED
@@ -93,10 +93,10 @@ export namespace EntryPoints {
93
93
  namespace Client {
94
94
  interface fieldChangedContext {
95
95
  currentRecord: N_record.ClientCurrentRecord;
96
- sublistId: string;
96
+ sublistId: string | null;
97
97
  fieldId: string;
98
- line: number;
99
- column: number;
98
+ line?: number;
99
+ column?: number;
100
100
  }
101
101
 
102
102
  type fieldChanged = (scriptContext: fieldChangedContext) => void;
@@ -117,7 +117,7 @@ export namespace EntryPoints {
117
117
 
118
118
  interface postSourcingContext {
119
119
  currentRecord: N_record.ClientCurrentRecord;
120
- sublistId: string;
120
+ sublistId?: string;
121
121
  fieldId: string;
122
122
  }
123
123
 
@@ -150,7 +150,7 @@ export namespace EntryPoints {
150
150
 
151
151
  interface validateFieldContext {
152
152
  currentRecord: N_record.ClientCurrentRecord;
153
- sublistId: string|null;
153
+ sublistId?: string;
154
154
  fieldId: string;
155
155
  line?: number;
156
156
  column?: number;
@@ -187,7 +187,7 @@ export namespace EntryPoints {
187
187
  form: N_ui_serverWidget.Form;
188
188
  type: UserEventType;
189
189
  UserEventType: UserEventTypes;
190
- request: N_http.ServerRequest;
190
+ request: N_http.ServerRequest | undefined;
191
191
  }
192
192
 
193
193
  type beforeLoad = (scriptContext: beforeLoadContext) => void;
@@ -528,4 +528,4 @@ export namespace EntryPoints {
528
528
  interface IKeyValuePair {
529
529
  key: string|object;
530
530
  value: string|object;
531
- }
531
+ }
@@ -1,13 +1,23 @@
1
1
  /**
2
- * @NAPIVersion 2.0
2
+ * @NAPIVersion 2.1
3
3
  * @NScriptType UserEventScript
4
4
  */
5
5
 
6
6
  import {EntryPoints} from 'N/types'
7
7
  import log = require('N/log');
8
+ import query = require('N/query');
8
9
 
10
+ // Let's assume this example is deployed to sales orders
9
11
  export function beforeSubmit(ctx: EntryPoints.UserEvent.beforeSubmitContext) {
10
12
  if (ctx.type == ctx.UserEventType.CREATE) {
11
- log.debug('Entity Id', ctx.newRecord.getValue('entity')); // When creating a transaction from an entity, log the entity internal id
13
+ const customerId = ctx.newRecord.getValue('entity') as string;
14
+ log.debug('beforeSubmit', `Submitting new transaction for entity: ${customerId}`); // When creating a transaction from an entity, log the entity internal id
15
+
16
+ // SuiteQL example
17
+ const results: { companyname: string }[] = query.runSuiteQL({
18
+ query: `SELECT companyName FROM customer WHERE id = ?`,
19
+ params: [customerId]
20
+ }).asMappedResults() as any;
21
+ log.debug('beforeSubmit', `Customer ${customerId} values: ${JSON.stringify(results)}`);
12
22
  }
13
23
  }
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "posttest": "npm run cleanup"
9
9
  },
10
10
  "homepage": "https://github.com/headintheclouddev/typings-suitescript-2.0",
11
- "version": "2024.2.5",
11
+ "version": "2024.2.7",
12
12
  "author": "Head in the Cloud Development <gurus@headintheclouddev.com> (www.headintheclouddev.com)",
13
13
  "license": "MIT",
14
14
  "repository": {