@hitc/netsuite-types 2024.2.4 → 2024.2.6

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.
@@ -147,9 +147,9 @@ interface StandardLine {
147
147
  /** Returns the debit amount for a StandardLine object. */
148
148
  readonly debitAmount: string;
149
149
  /** Returns the internal NetSuite ID for the department on a StandardLine object. */
150
- readonly departmentId: string;
150
+ readonly departmentId: number;
151
151
  /** Returns the internal NetSuite ID for the entity on a StandardLine object. */
152
- readonly entityId: string;
152
+ readonly entityId: number;
153
153
  /** Returns the internal NetSuite database ID for a standard GL impact line. */
154
154
  readonly id: number;
155
155
  /** Returns true if the transaction is a posting transaction and the associated standard GL impact line posts to the general ledger. Returns false if the transaction is a non-posting transaction. */
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;
@@ -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.4",
11
+ "version": "2024.2.6",
12
12
  "author": "Head in the Cloud Development <gurus@headintheclouddev.com> (www.headintheclouddev.com)",
13
13
  "license": "MIT",
14
14
  "repository": {