@hitc/netsuite-types 2024.2.2 → 2024.2.5

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/format.d.ts CHANGED
@@ -81,6 +81,7 @@ export enum Type {
81
81
  CCNUMBER = "ccnumber",
82
82
  CCVALIDFROM = "ccvalidfrom",
83
83
  CHECKBOX = "checkbox",
84
+ CLOBTEXT = "clobtext",
84
85
  COLOR = "color",
85
86
  CURRENCY = "currency",
86
87
  CURRENCY2 = "currency2",
@@ -99,6 +100,7 @@ export enum Type {
99
100
  IDENTIFIERANYCASE = "identifieranycase",
100
101
  INTEGER = "integer",
101
102
  MMYYDATE = "mmyydate",
103
+ MULTISELECT = "multiselect",
102
104
  NONNEGCURRENCY = "nonnegcurrency",
103
105
  NONNEGFLOAT = "nonnegfloat",
104
106
  PACKAGE = "package",
@@ -112,6 +114,7 @@ export enum Type {
112
114
  RATE = "rate",
113
115
  RATEHIGHPRECISION = "ratehighprecision",
114
116
  SELECT = "select",
117
+ SUBRECORD_FIELD_TYPE = "summary",
115
118
  TEXT = "text",
116
119
  TEXTAREA = "textarea",
117
120
  TIME = "time",
@@ -0,0 +1,206 @@
1
+ import * as N_record from '../record';
2
+
3
+ interface FindSublistLineWithValueOptions {
4
+ /** The internal ID of the sublist. */
5
+ sublistId: string;
6
+ /** The internal ID of a standard or custom sublist field. */
7
+ fieldId: string;
8
+ /** The value to search for. */
9
+ value: N_record.FieldValue;
10
+ }
11
+
12
+ interface GetFieldOptions {
13
+ /** The internal ID of a standard or custom body field. */
14
+ fieldId: string;
15
+ }
16
+
17
+ interface SublistOptions {
18
+ /** The internal ID of the sublist. */
19
+ sublistId: string;
20
+ }
21
+
22
+ interface SublistLineOptions {
23
+ /** The internal ID of the sublist. */
24
+ sublistId: string;
25
+ /** The internal ID of a standard or custom body field. */
26
+ fieldId: string;
27
+ line: number;
28
+ }
29
+
30
+ export interface ReadOnlySubrecord {
31
+ /** Returns the body field names (internal IDs) of all the fields in the subrecord, including the machine header field and matrix header fields. */
32
+ readonly fields: string[];
33
+ /** Returns all the names (internal IDs) of all the sublists in the subrecord. */
34
+ readonly sublists: string[];
35
+ /** Returns the line number for the first occurrence of a field value in a sublist. Note that line indexing begins at 0 with SuiteScript 2.0. */
36
+ findSublistLineWithValue(options: FindSublistLineWithValueOptions): number;
37
+ /** Returns the number of lines in a sublist. */
38
+ getLineCount(options: SublistOptions): number;
39
+ /** Returns all the field names (internal IDs) in a sublist. */
40
+ getSublistFields(options: SublistOptions): string[];
41
+ /** Returns the value of a sublist field in a text representation. */
42
+ getSublistText(options: SublistLineOptions): string;
43
+ /** Returns the text representation of a field value. */
44
+ getText(options: GetFieldOptions): string;
45
+ /** Returns the value of a field. */
46
+ getValue(options: GetFieldOptions): N_record.FieldValue;
47
+ }
48
+
49
+ export interface ReadOnlyTransactionRecord {
50
+ /** Use this property to get the internal ID of a record when editing an existing transaction. */
51
+ readonly id: number | null;
52
+ /** Returns the record type internal ID. */
53
+ readonly recordType: N_record.Type | string;
54
+ /** Returns the body field names (internal IDs) of all the fields in the transaction record, including the machine header field and matrix header fields. */
55
+ readonly fields: string[];
56
+ /** Returns all the names (internal IDs) of all the sublists in the transaction record. */
57
+ readonly sublists: string[];
58
+ /** Returns the line number for the first occurrence of a field value in a sublist. Note that line indexing begins at 0 with SuiteScript 2.0. */
59
+ findSublistLineWithValue(options: FindSublistLineWithValueOptions): number;
60
+ /** Returns the number of lines in a sublist. */
61
+ getLineCount(options: SublistOptions): number;
62
+ /** Returns all the field names (internal IDs) in a sublist */
63
+ getSublistFields(options: SublistOptions): string[];
64
+ /** Returns the subrecord associated with a sublist field. */
65
+ getSublistSubrecord(options: SublistLineOptions): ReadOnlySubrecord;
66
+ /** Returns the value of a sublist field in a text representation. */
67
+ getSublistText(options: SublistLineOptions): string;
68
+ /** Returns the value of a sublist field. */
69
+ getSublistValue(options: SublistLineOptions): N_record.Type | string;
70
+ /** Returns the subrecord for the associated field. */
71
+ getSubrecord(options: GetFieldOptions): ReadOnlySubrecord;
72
+ /** Returns the text representation of a field value. */
73
+ getText(options: GetFieldOptions): string;
74
+ /** Returns the value of a field. */
75
+ getValue(options: GetFieldOptions): N_record.FieldValue;
76
+ /** Returns the value indicating whether the associated sublist field contains a subrecord */
77
+ hasSublistSubrecord(options: SublistLineOptions): boolean;
78
+ /** Returns the value indicating whether the field contains a subrecord. */
79
+ hasSubrecord(options: GetFieldOptions): boolean;
80
+ }
81
+
82
+ interface GetSegmentOptions {
83
+ /** String value of the custom segment ID. */
84
+ segmentId: string;
85
+ }
86
+
87
+ interface SetsegmentOptions extends GetSegmentOptions {
88
+ /** Internal ID of the custom segment value that the custom line should be set to. Omitting this parameter unsets the custom segment value. */
89
+ segmentValueId: number;
90
+ }
91
+
92
+ /* Taken from https://suiteanswers.custhelp.com/app/answers/detail/a_id/1017098 */
93
+ interface CustomLine {
94
+ /** Sets the account ID property for a CustomLine object in a primary or secondary book. */
95
+ accountId: number;
96
+ /** Returns the amount for a CustomLine. If it is a credit, than the amount will include a negative sign. */
97
+ readonly amount: string;
98
+ /** Sets the class ID value for a CustomLine object in a primary or secondary book. This value is the internal NetSuite ID for a class. */
99
+ classId: number;
100
+ /** Sets the credit amount of a CustomLine object in a primary or secondary book. The value is rounded to currency precision. */
101
+ creditAmount: string;
102
+ /** Sets the debit amount of a CustomLine object in a primary or secondary book. The value is rounded to currency precision. */
103
+ debitAmount: string;
104
+ /** Sets the department ID for a CustomLine object in a primary or secondary book. This value is the internal NetSuite ID for a department. */
105
+ departmentId: number;
106
+ /** Sets the entity ID property for a CustomLine object in a primary or secondary book. */
107
+ entityId: number;
108
+ /** Sets a custom GL impact line to affect only the primary book in a Custom GL plug-in implementation */
109
+ isBookSpecific: boolean;
110
+ /** Sets the location ID for a CustomLine object in a primary or secondary book. This value is the internal NetSuite ID for a location. */
111
+ locationId: number;
112
+ /** Sets the Memo field on a CustomLine object. */
113
+ memo: string;
114
+ /** Returns a string array of available custom segment IDs for which a value can be set. */
115
+ readonly segments: string[];
116
+ /** Returns the internal NetSuite ID for the custom segment value set on the line on a CustomLine object */
117
+ getSegmentValueId(options: GetSegmentOptions): number;
118
+ /** Sets custom segment values on a CustomLine object */
119
+ setSegmentValueId(options: SetsegmentOptions): void;
120
+ }
121
+
122
+ interface GetLineOptions {
123
+ /** The line number starting at index 0 */
124
+ index: number
125
+ }
126
+
127
+ /* Taken from https://suiteanswers.custhelp.com/app/answers/detail/a_id/1017095 */
128
+ interface CustomLines {
129
+ /** Returns the number of custom lines with GL impact for a specific accounting book in a transaction */
130
+ readonly count: number;
131
+ /** Adds a CustomLine object to the parent CustomLines object in a Custom GL Lines plug-in implementation and returns the new object. Use this method to add a custom line with GL impact to a transaction. */
132
+ addNewLine(): CustomLine;
133
+ /** Returns a CustomLine object that represents a custom line with GL impact. CustomLine objects are stored in the CustomLines object starting at index 0. */
134
+ getLine(options: GetLineOptions): CustomLine
135
+ }
136
+
137
+ /* Taken from https://suiteanswers.custhelp.com/app/answers/detail/a_id/1017097 */
138
+ interface StandardLine {
139
+ /** Returns the internal NetSuite ID of the entity for a StandardLine object */
140
+ readonly accountId: number;
141
+ /** Returns the amount for a StandardLine. */
142
+ amount: string;
143
+ /** Returns the internal NetSuite ID for the class on a StandardLine object. */
144
+ readonly classId: number;
145
+ /** Returns the credit amount for a StandardLine object. */
146
+ readonly creditAmount: string;
147
+ /** Returns the debit amount for a StandardLine object. */
148
+ readonly debitAmount: string;
149
+ /** Returns the internal NetSuite ID for the department on a StandardLine object. */
150
+ readonly departmentId: number;
151
+ /** Returns the internal NetSuite ID for the entity on a StandardLine object. */
152
+ readonly entityId: number;
153
+ /** Returns the internal NetSuite database ID for a standard GL impact line. */
154
+ readonly id: number;
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. */
156
+ readonly isPosting: boolean;
157
+ /** Returns true if a standard GL impact line is a credit to a tax account. */
158
+ readonly isTaxable: boolean;
159
+ /** Returns the internal NetSuite ID for the location on a StandardLine object. */
160
+ readonly locationId: number;
161
+ /** Returns the Memo field on a StandardLine object. */
162
+ readonly memo: string;
163
+ /** Returns the internal NetSuite ID of the subsidiary for the entity associated with a standard GL impact line. */
164
+ readonly subsidiaryId: number;
165
+ /** Returns a string that represents the amount of tax charged on a standard GL line. */
166
+ readonly taxAmount: string;
167
+ /** Returns a string that represents the amount of a standard GL line that was subject to tax. */
168
+ readonly taxableAmount: string;
169
+ /** Returns the internal NetSuite ID of the tax code for a standard GL line. */
170
+ readonly taxItemId: number;
171
+ /** Returns the tax type for a standard GL line that was subject to tax. */
172
+ readonly taxType: string;
173
+
174
+ /** Returns the internal NetSuite ID for the custom segment value set on the line on a StandardLine object. */
175
+ getSegmentValueId(options: GetSegmentOptions): number;
176
+ }
177
+
178
+ /* Taken from https://suiteanswers.custhelp.com/app/answers/detail/a_id/1017094 */
179
+ interface StandardLines {
180
+ /** Returns the number of standard lines with GL impact for a specific accounting book in a transaction. Use this method in conjunction with to read individual standard lines. */
181
+ readonly count: number;
182
+ /** Returns a StandardLine object that represents a standard line with GL impact. StandardLine objects are stored in the StandardLines object starting at index 0. */
183
+ getLine(options: GetLineOptions): StandardLine
184
+ }
185
+
186
+ /* Taken from https://suiteanswers.custhelp.com/app/answers/detail/a_id/1017096 */
187
+ interface AccountingBook {
188
+ /** Returns the internal NetSuite ID for the accounting book to be passed to a Custom GL Lines plug-in implementation. */
189
+ readonly id: number;
190
+ /** Returns true if the book object is the primary accounting book for the NetSuite account or returns false if the accounting book is a secondary accounting book. */
191
+ readonly isPrimary: boolean;
192
+ }
193
+
194
+ /* Taken from https://suiteanswers.custhelp.com/app/answers/detail/a_id/1016989 */
195
+ interface glPluginContext {
196
+ /** Contains an array of all standard lines with GL impact in a transaction as StandardLine objects. */
197
+ standardLines: StandardLines;
198
+ /** Contains an array of all custom lines with GL impact in a transaction as CustomLine objects. */
199
+ customLines: CustomLines;
200
+ /** Use this to access properties of the transaction with SuiteScript API nlobjRecord functions. You cannot modify the transaction. */
201
+ transactionRecord: ReadOnlyTransactionRecord;
202
+ /** Represents the accounting book passed to a Custom GL plug-in implementation when you save a transaction. Use the methods available to the book object to determine if the book is a primary or secondary book or get the internal NetSuite ID of the accounting book. */
203
+ book: AccountingBook;
204
+ }
205
+
206
+ export type customizeGlImpact = (context: glPluginContext) => void;
package/N/types.d.ts CHANGED
@@ -5,6 +5,7 @@ import * as N_search from './search';
5
5
  import * as N_ui_serverWidget from './ui/serverWidget';
6
6
  import * as N_FiConnectivity from "./plugins/fiConnectivityPlugin";
7
7
  import * as N_FiParser from "./plugins/fiParserPlugin";
8
+ import * as N_GlPlugin from "./plugins/glPlugin";
8
9
  import * as N_dataset from "./dataset";
9
10
  import * as N_workbook from "./workbook";
10
11
 
@@ -495,6 +496,13 @@ export namespace EntryPoints {
495
496
 
496
497
  type createWorkbook = (scriptContext: createWorkbookContext) => void;
497
498
  }
499
+
500
+ namespace GlPlugin {
501
+ interface glPluginContext extends N_GlPlugin.glPluginContext {
502
+ }
503
+
504
+ type customizeGlImpact = N_GlPlugin.customizeGlImpact;
505
+ }
498
506
  }
499
507
 
500
508
  namespace CustomRecordAction {
@@ -520,4 +528,4 @@ export namespace EntryPoints {
520
528
  interface IKeyValuePair {
521
529
  key: string|object;
522
530
  value: string|object;
523
- }
531
+ }
package/SuiteGL.d.ts CHANGED
@@ -1,3 +1,12 @@
1
+ /**
2
+ * NOTE: This file is for SSV1 as of Sept 2024 SSV2 is now supported and has been added to the SSV2. To use
3
+ * the SSV2 version (recommended) the types can be found in EntryPoints namespace in N/types
4
+ *
5
+ * EntryPoints.Plugins.GlPlugin.customizeGlImpact
6
+ *
7
+ *
8
+ */
9
+
1
10
  /**
2
11
  * Represents the accounting book passed to a Custom GL Lines plug-in implementation when you save a transaction.
3
12
  * Use the methods available to the book object to determine if the book is a primary or secondary book or get
@@ -0,0 +1,34 @@
1
+ /**
2
+ * @NApiVersion 2.1
3
+ * @NScriptType customglplugin
4
+ */
5
+
6
+ /* This example is taken from https://suiteanswers.custhelp.com/app/answers/detail/a_id/1016997 */
7
+
8
+ import { EntryPoints } from "N/types";
9
+ import * as log from "N/log";
10
+
11
+ export const customizeGlImpact: EntryPoints.Plugins.GlPlugin.customizeGlImpact =
12
+ (context: EntryPoints.Plugins.GlPlugin.glPluginContext) => {
13
+ const customLines = context.customLines;
14
+ const amount = "100.00";
15
+
16
+ const memo = context.transactionRecord.getValue({ fieldId: "memo" });
17
+ const firstAccount = context.standardLines.getLine({ index: 0 }).accountId;
18
+ const secondAccount = context.standardLines.getLine({ index: 1 }).accountId;
19
+ const bookId = context.book.id;
20
+
21
+ const firstLine = customLines.addNewLine();
22
+ firstLine.accountId = firstAccount;
23
+ firstLine.creditAmount = amount;
24
+ firstLine.memo = memo + " for book " + bookId;
25
+ firstLine.isBookSpecific = false;
26
+
27
+ const secondLine = customLines.addNewLine();
28
+ secondLine.accountId = secondAccount;
29
+ secondLine.debitAmount = amount;
30
+ secondLine.memo = memo + " for book " + bookId;
31
+ secondLine.isBookSpecific = false;
32
+
33
+ log.audit("Added GL Entries", { customLines });
34
+ };
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.2",
11
+ "version": "2024.2.5",
12
12
  "author": "Head in the Cloud Development <gurus@headintheclouddev.com> (www.headintheclouddev.com)",
13
13
  "license": "MIT",
14
14
  "repository": {
package/tsconfig.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "compilerOptions": {
3
+ "strict": true,
3
4
  "module": "amd",
4
5
  "target": "es5",
5
- "moduleResolution":"node",
6
+ "moduleResolution": "node",
6
7
  "sourceMap": false,
7
8
  "newLine": "LF",
8
9
  "esModuleInterop": true,