-
Notifications
You must be signed in to change notification settings - Fork 2
/
global.d.ts
2027 lines (1708 loc) · 95.8 KB
/
global.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/// <reference path="$$rhino.d.ts" />
/// <reference path="Packages.d.ts" />
/// <reference path="GlideScriptable.d.ts" />
/// <reference path="sn_kmf_ns.d.ts" />
//#region TypeDefs
declare type EncryptionAlgorithmHashType = "MD-2" | "MD-5" | "SHA-1" | "SHA-224" | "SHA-256" | "SHA-384" | "SHA-512";
declare type EncryptionAlgorithmSignType = "NONEwithRSA" | "MD2withRSA" | "MD5withRSA" | "SHA1withRSA" | "SHA224withRSA" | "SHA256withRSA" | "SHA384withRSA" |
"SHA512withRSA" | "NONEwithDSA" | "SHA1withDSA" | "SHA224withDSA" | "SHA256withDSA" | "NONEwithECDSA" | "SHA1withECDSA" | "SHA224withECDSA" | "SHA256withECDSA" |
"SHA384withECDSA" | "SHA512withECDSA";
declare type TaskAppproval = "not requested" | "cancelled" | "requested" | "duplicate" | "not_required" | "approved" | "rejected";
/**
* email=Email; endpoint_security=Endpoint Security; ids_ips=IDS/IPS; network_monitoring=Network Monitoring; phone=Phone; self-service=Self-service; siem=SIEM; virtual_agent=Virtual Agent; vulnerability_response=Vulnerability Response; walk-in=Walk-in
*/
declare type TaskContactType = "email" | "endpoint_security" | "ids_ips" | "network_monitoring" | "phone" | "self-service" | "siem" | "virtual_agent" | "vulnerability_response" | "walk-in";
declare type TaskEscalationNumber = 0 | 1 | 2 | 3;
declare type TaskEscalationString = "0" | "1" | "2" | "3";
declare type TaskEscalationValue = TaskEscalationNumber | TaskEscalationString;
/**
*
* @description 1="1 - High"; 2="2 - Medium"; 3="3 - Low"
*/
declare type Task3ScaleNumber = 1 | 2 | 3;
declare type Task3ScaleString = "1" | "2" | "3";
declare type Task3ScaleValue = Task3ScaleNumber | Task3ScaleString;
declare type TaskPriorityNumber = 1 | 2 | 3 | 4 | 5;
declare type TaskPriorityString = "1" | "2" | "3" | "4" | "5";
declare type TaskPriorityValue = TaskPriorityNumber | TaskPriorityString;
/**
*
* @description -5="Pending"; 1="Open"; 2="Work in Progress"; 3="Closed Complete"; 4="Closed Incomplete"; 7="Closed Skipped"
*/
declare type TaskStateNumber = -5 | 1 | 2 | 3 | 4 | 7;
declare type TaskStateString = "-5" | "1" | "2" | "3" | "4" | "7";
declare type TaskStateValue = TaskStateNumber | TaskStateString;
declare type IncidentCloseCode = "Solved (Work Around)" | "Solved (Permanently)" | "Solved Remotely (Work Around)" | "Solved Remotely (Permanently)" | "Not Solved (Not Reproducible)" | "Not Solved (Too Costly)" | "Closed/Resolved by Caller";
/**
*
* @description 1="Awaiting Caller"; 5="Awaiting Change"; 3="Awaiting Problem"; 4="Awaiting Vendor"
*/
declare type IncidentHoldReasonNumber = 1 | 5 | 3 | 4;
declare type IncidentHoldReasonString = "1" | "5" | "3" | "4";
declare type IncidentHoldReasonValue = IncidentHoldReasonNumber | IncidentHoldReasonString;
/**
*
* @description 1="New"; 2="In Progress"; 3="On Hold"; 6="Resolved"; 7="Closed"; 8="Canceled"
*/
declare type IncidentStateNumber = 1 | 2 | 3 | 6 | 7 | 8;
declare type IncidentStateString = "1" | "2" | "3" | "6" | "7" | "8";
declare type IncidentStateValue = IncidentStateNumber | IncidentStateString;
declare type IncidentNotifyNumber = 1 | 2 | 3;
declare type IncidentNotifyString = "1" | "2" | "3";
declare type IncidentNotifyValue = IncidentNotifyNumber | IncidentNotifyString;
/**
*
* @description 1="Success"; 2="Fail"
*/
declare type ChangeReviewStatusNumber = 1 | 2;
declare type ChangeReviewStatusString = "1" | "2";
declare type ChangeReviewStatusValue = ChangeReviewStatusNumber | ChangeReviewStatusString;
/**
*
* @description 2="High"; 3="Moderate"; 4="Low"
*/
declare type ChangeRiskNumber = 2 | 3 | 4;
declare type ChangeRiskString = "2" | "3" | "4";
declare type ChangeRiskValue = ChangeRiskNumber | ChangeRiskString;
/**
*
* @description 1="Massive"; 2="Large"; 3="Medium"; 4="Small"; 5="Tiny"
*/
declare type ChangeScopeNumber = 1 | 2 | 3 | 4 | 5;
declare type ChangeScopeString = "1" | "2" | "3" | "4" | "5";
declare type ChangeScopeValue = ChangeScopeNumber | ChangeScopeString;
declare type ChangeType = "standard" | "normal" | "emergency";
/**
*
* @description "successful"="Successful"; "successful_issues"="Successful with issues"; "unsuccessful"="Unsuccessful"
*/
declare type ChangeCloseCode = "successful" | "successful_issues" | "unsuccessful";
/**
*
* @description 1="Open"; 3="Pending Change"; 2="Known Error"; 4="Closed/Resolved"
*/
declare type ProblemStateNumber = 1 | 3 | 2 | 4;
declare type ProblemStateString = "1" | "3" | "2" | "4";
declare type ProblemStateValue = ProblemStateNumber | ProblemStateString;
/**
*
* @description "requested"="Pending Approval"; "in_process"="Approved"; "closed_complete"="Closed Complete"; "closed_incomplete"="Closed Incomplete"; "closed_cancelled"="Closed Cancelled"; "closed_rejected"="Closed Rejected"; "closed_skipped"="Closed Skipped"
*/
declare type IRequestState = "requested" | "in_process" | "closed_complete" | "closed_incomplete" | "closed_cancelled" | "closed_rejected" | "closed_skipped";
/**
* Query operator values that can be used for string value comparisons.
*/
declare type StringQueryOperator = "=" | "!=" | "IN" | "NOT IN" | "STARTSWITH" | "ENDSWITH" | "CONTAINS" | "DOES NOT CONTAIN" | "INSTANCEOF";
/**
* Query operator values that can be used for numerical operations.
*/
declare type NumberQueryOperator = "=" | "!=" | ">" | ">=" | "<" | "<=";
/**
* Query operator values.
*/
declare type QueryOperator = StringQueryOperator | NumberQueryOperator;
/**
* Type values for the "Type" field of the "Service Availibility" table (service_availility.type).
*/
declare type service_availabilityType = "daily" | "weekly" | "monthly" | "annually" | "last7days" | "last30days" | "last12months";
declare type AggregateType = "min" | "max" | "sum" | "avg" | "count";
declare type GlideProgressWorkerState = "starting" | "running" | "complete" | "cancelled" | "unknown";
declare type GlideProgressWorkerCompletionCode = "success" | "cancelled" | "error";
/**
* Represents an object type.
*/
declare type GlideJSType = "null" | "string" | "number" | "boolean" | "function" | "object";
declare type LocationType = "region" | "country" | "state/province" | "city" | "site" | "building/structure" | "floor" | "room" | "zone";
/**
* Names of workflow events availablein the base system.
*
* This was created by referencing {@link https://docs.servicenow.com/bundle/utah-servicenow-platform/page/administer/workflow-administration/reference/r_WorkflowEventsInTheBaseSystem.html}
* @enum {string}
*/
declare enum BaseSystemWorkflowEventNames {
/**
* Informs records in the Workflow Executing Activity [wf_executing] table about the completion of other activities in the same workflow context.
* If the activity is allowed to set the boolean value for wf_executing.notify_termination, then set the value to true (activity.notify_termination = true) during the onExecute event.
* Source: Workflow Engine, Process Terminations; Thread: Current thread, current mutex; Listeners: Join activity
* @summary String value used by activity definitions to respond to the onActivityComplete event handler.
*/
activityComplete = "activityComplete",
/**
* From within activity definitions:
*
* Informs all wf_executing records in a context that the workflow is being canceled.
* The End activity uses the global workflow.broadcastEvent('cancel') to interrupt the currently running wf_executing records. This changes the state of those records to Cancelled.
* Source: End activity; Thread: Current thread, current mutex; Listeners: All activities, onCancel event handler
*
* Outside current context:
*
* This event is the same as the cancel event above and handled the same. However, the management of this event is subtly different.
* This event informs all wf_executing records in a context that the workflow is being canceled.
* The event is managed via the onCancel event handler of each executing activity definition, but the event is called differently.
* In particular, the call to cancel from outside an activity definition is blocked by the current mutex.
* This is a significant difference in that the event does not interrupt a currently executing activity that is still operating within the parameters of the current mutex.
* Any script can call cancel on a known executing context via the workflow script include.
* Source: Any script include, scheduled job, UI action, or other source; Thread: Current thread, private mutex; Listeners:All activities, onCancel event handler
* @summary String value used by workflow activities to respond to a request for cancellation.
*/
cancel = "cancel",
/**
* Informs wf_executing records for approval activities about an approval that completed and triggered the timer event.
* Approval Coordinator both registers for the event and triggers the event. The child approvals have listeners that determine their approval state.
* Source: Approval Coordinator triggers the event during its onExecute; Thread: Current thread, current mutex;
* Listeners: Approval Coordinator, Approval - User, and Approval - Group all have onDetermineApprovalState event handlers.
* If the state is anything but Requested, the activity is considered finished, and the approval state (Approved, Rejected, Cancelled) is set to the wf_executing.result column
* @summary String value used by approval activities to respond to a change in the overall approval status of the current record.
*/
determineApprovalState = "determineApprovalState",
/**
* Informs a record in the wf_executing table with the initial state of Executing to proceed with its primary work.
* The workflow engine, for each transition executed, creates an executing record with a state of Executing. Once created, the executing record is put in a queue for processing.
* For each item in the queue, the Rhino globals are established, the activity definition that drives the executing record is instantiated, and the run() function is called.
* When the state of a record is Executing, this function always calls onExecute.
* Source: Workflow engine, via the WFActivity Handler; Thread: Current thread, current mutex; Listeners: All activities, onExecute event handler
*
* Lock Activities
*
* This is also the string value used by the Lock activity to respond to a waiting lock that is ready to make another attempt to obtain a specific lock.
* For Lock activities, this informs a wf_executing record waiting to execute that the specified wait interval has passed and that it should attempt to get the lock again.
* The execute event for a Lock activity is different because it is called on a separate thread, at specified intervals, and is treated as an outside event.
* Source: Lock activity via a scheduled job; Thread: Worker thread, private mutex; Listeners: Lock activity, onExecute event handler
* @summary String value used by workflow activities to respond to a Timer activity that has expired.
*/
execute = "execute",
/**
* When a main workflow calls a subflow, the workflow keeps the ID of the subflow's context in the scratchpad. When the subflow is complete, it triggers the listener event via a business rule.
* The listener event is passed to the parent context on completion of a subflow and is managed by the onListener action of the workflow activity.
* Source: Business rule that is triggered by the update of a workflow that has a parent; Thread: Current thread, current mutex;
* Listeners: This event is used by a subflow to inform it's parent flow that it is complete. The parent workflow will react to this event and continue.
* @summary String value that the workflow (subflow) activity triggers as an event.
*/
listener = "listener",
/**
* When an SLA is paused, the SLA workflows must be paused if there is a timer running.
* Use is exclusive to the SLA timer.
* Source: SLA; Thread: Business rule thread, private mutex; Listeners: Timer activity
* @summary String value sent to a workflow from an SLA to pause the Timer activity.
*/
pause = "pause",
/**
* String value triggered in the workflow by an Orchestration activity indicating that the MID Server has completed a task.
* The onProbe_complete event handler is in the WebServiceActivityHandler and is used by most Orchestration activities.
* Source: Event used to restate a workflow that is waiting for the MID Server to process a task or activity; Thread: Worker thread, private mutex; Listeners: Orchestration activities
* @summary String value triggered in the workflow by an Orchestration activity indicating that the MID Server has completed a task.
*/
probe_complete = "probe_complete",
/**
* When an SLA is resumed, the SLA workflows must be resumed as well.
* Use is exclusive to the SLA timer.
* Source: SLA; Thread: Business rule thread, private mutex; Listeners: Timer activity
* @summary String value used by the Timer activity to resume a paused timer (see {@link BaseSystemWorkflowEventNames#pause}).
*/
resume = "resume",
/**
* The End activity checks for this event. This is only in the End activity.
* Source: Any script can trigger or broadcast the stop event via a script include or workflow Run Script activity; Thread: Current thread, current mutex;
* Listeners: This event is used by the End activity to exclude the Cancel activity and allow a workflow to end, even if canceled.
* @summary The End activity checks for this event.
*/
stop = "stop",
/**
* Allows wf_executing records to be informed about a timer activity that has completed and has fired the timer event.
* The Timer activity schedules a job that calls a script. The script calls fireEvent (wf_executing, timer).
* Source: Timer activity via a scheduled job; Thread: Worker thread, private mutex; Listeners: Timer activity, onTimer event handler
* @summary String value used by workflow activities to respond to a Timer activity that has expired.
*/
timer = "timer",
/**
* Informs records in the Workflow Executing Activity [wf_executing] table about an otherEvent that has completed.
* The Join activity transitions from n number of preceding activities. These preceding activities all create a wf_executing record, which causes a check to see if the record already exists.
* If the Join already exists, then the Join created by the executing transition sets the wf_executing record for deletion.
* Source: Join activity; Thread: Current thread, current mutex; Listeners: Join activity, onOtherEvent event handler
* @summary String value used by the Join activity to respond to an otherEvent.
*/
otherEvent = "otherEvent"
}
declare type WorkflowOperationType = "insert" | "update" | "delete";
//#endregion
interface ArrayConstructor {
/**
* @deprecated DO NOT USE - does not exist in server script.
*/
from<T>(iterable: Iterable<T> | ArrayLike<T>): T[];
/**
* @deprecated DO NOT USE - does not exist in server script.
*/
from<T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
}
declare namespace global {
/**
* ArrayUtil API is a script include with useful functions for working with JavaScript arrays.
* @see {@link https://docs.servicenow.com/bundle/utah-api-reference/page/app-store/dev_portal/API_reference/ArrayUtil/concept/c_ArrayUtilAPI.html}
* @see {@link https://developer.servicenow.com/dev.do#!/reference/api/utah/server_legacy/c_ArrayUtilAPI}
*/
export class ArrayUtil {
/**
* Merge two arrays.
* @template T - The element type,
* @param {T[]} parent - An array to merge.
* @param {T[]} child - An array to merge.
* @return {T[]} An array of elements from both input arrays. Duplicates are not removed.
*/
concat<T>(parent: T[], child: T[]): T[];
/**
* Searches the array for the specified element.
* @template T - The element type,
* @param {T[]} array
* @param {T} element
* @return {boolean} True if the element exists in the array; otherwise returns false.
*/
contains<T>(array: T[], element: T): boolean;
/**
* Converts a Java object to an array.
* @param {*} a - Object to convert.
* @return {any[]} Array created from the object.
*/
convertArray(a: any): any[];
/**
* Finds the differences between two or more arrays.
* @template T - The element type.
* @param {T[]} a - The first array.
* @param {T[]} b - The second array.
* @param {...T[]} c - Zero or more additional arrays.
* @return {T[]} - Returns an array of items from array a that were not found in any other input array. Duplicates are removed from the result.
*/
diff<T>(a: T[], b: T[], ...c: T[]): T[];
/**
* Returns an array from the specified object.
* @param {*} obj - Object from which to create an array.
* @return {any[]} Array created from the object.
*/
ensureArray(object: any): any[];
/**
* Searches the array for the element.
* @template T - The element type.
* @param {T} array - Array to search.
* @param {T} element - Element to search for.
* @param {number} [startIndex] - The optional zero-based index to start searching from.
* @return {number} Zero-based position of the element in the array, or -1 if the element is not found.
*/
indexOf<T>(array: T, element: T, startIndex?: number): number;
/**
* Finds the elements present in all arrays.
* @template T - The element type.
* @param {T[]} a - The first array.
* @param {T[]} b - The second array.
* @param {...T[]} c - Zero or more additional arrays.
* @return {T[]} An array of elements from array a that were found in all of the other input arrays. Duplicates are removed.
*/
intersect<T>(a: T[], b: T[], ...c: T[]): T[];
/**
* Merge two or more arrays.
* @template T - The element type.
* @param {T[]} a - The first array.
* @param {T[]} b - The second array.
* @param {...T[]} c - Zero or more additional arrays.
* @return {T[]} An array of items from all the input arrays. Duplicates are removed.
*/
union<T>(a: T[], b: T[], ...c: T[]): T[];
/**
* Removes duplicate items from an array.
* @template T - The element type.
* @param {T[]} a - The array to check for duplicate elements.
* @return {T[]} An array of unique items from the input array.
*/
unique<T>(a: T[]): T[];
}
export interface IAbstractAjaxProcessor {
readonly CALLABLE_PREFIX: 'ajaxFunction_';
// readonly prototype: AbstractAjaxProcessor;
readonly request?: GlideServletRequest;
readonly responseXML?: XMLDocument2;
readonly gc?: Packages.com.glide.script.GlideController;
initialize(request?: GlideServletRequest, responseXML?: XMLDocument2, gc?: Packages.com.glide.script.GlideController): void;
process(): any;
newItem(name?: string): Packages.org.w3c.dom.Element;
/**
* returns value of parameter as a Java String instance
* @param {string} name - The name of the parameter
* @return {$$rhino.String} The value of the parameter.
*/
getParameter(name: string): $$rhino.Nilable<$$rhino.String>;
getDocument(): XMLDocument2 | undefined;
getRootElement(): Packages.org.w3c.dom.Element;
/**
* Returns value of "sysparm_name" as a Java String instance
* @return {$$rhino.Stringg}
*/
getName(): $$rhino.String;
/**
* Returns value of "sysparm_value" as a Java String instance
* @return {$$rhino.String}
*/
getValue(): $$rhino.String;
/**
* Returns value of "sysparm_type" as a Java String instance
* @return {$$rhino.String}
*/
getType(): $$rhino.String;
getChars(): $$rhino.String;
setAnswer(value: any): void;
setError(error: any): void;
}
export interface AbstractAjaxProcessorConstructor extends $$class.Constructor<AbstractAjaxProcessor, IAbstractAjaxProcessor & Readonly<{ prototype: AbstractAjaxProcessor }>> {
new(): AbstractAjaxProcessor;
(): AbstractAjaxProcessor;
}
/**
* Base ajax processor class that other ajax processors extend
*/
export class AbstractAjaxProcessor implements IAbstractAjaxProcessor {
readonly CALLABLE_PREFIX: 'ajaxFunction_';
constructor();
readonly prototype: AbstractAjaxProcessor;
readonly request?: GlideServletRequest;
readonly responseXML?: XMLDocument2;
readonly gc?: Packages.com.glide.script.GlideController;
initialize(request?: GlideServletRequest, responseXML?: XMLDocument2, gc?: Packages.com.glide.script.GlideController): void;
process(): any;
newItem(name?: string): Packages.org.w3c.dom.Element;
/**
* returns value of parameter as a Java String instance
* @param {string} name - The name of the parameter
* @return {$$rhino.String} The value of the parameter.
*/
getParameter(name: string): $$rhino.Nilable<$$rhino.String>;
getDocument(): XMLDocument2 | undefined;
getRootElement(): Packages.org.w3c.dom.Element;
/**
* Returns value of "sysparm_name" as a Java String instance
* @return {$$rhino.Stringg}
*/
getName(): $$rhino.String;
/**
* Returns value of "sysparm_value" as a Java String instance
* @return {$$rhino.String}
*/
getValue(): $$rhino.String;
/**
* Returns value of "sysparm_type" as a Java String instance
* @return {$$rhino.String}
*/
getType(): $$rhino.String;
getChars(): $$rhino.String;
setAnswer(value: any): void;
setError(error: any): void;
}
/**
* Attachment utilities
*/
export class AttachmentUtils {
attInptStream: GlideScriptableInputStream;
/**
* Creates an instance of AttachmentUtils.
* @param {string} attachmentSysId - Attachment sys_id.
*/
constructor(attachmentSysId: string);
/**
* Gets MD5 checksum for the attachment identified by the attachmentSysId parameter in the class initialization.
* @return {$$rhino.String} MD5 checksum string.
*/
getMD5ChecksumFromAttachment(): $$rhino.String;
/**
* Gets SHA1 checksum for the attachment identified by the attachmentSysId parameter in the class initialization.
* @return {$$rhino.String} SHA1 checksum string
*/
getSHA1ChecksumFromAttachment(): $$rhino.String;
/**
* Gets SHA256 checksum for the attachment identified by the attachmentSysId parameter in the class initialization.
* @return {$$rhino.String} SHA256 checksum string
*/
getSHA256ChecksumFromAttachment(): $$rhino.String;
/**
* Gets MD5 Hex checksum for the attachment identified by the attachmentSysId parameter in the class initialization.
* @return {$$rhino.String} MD5 Hex checksum string
*/
getMD5HexChecksumFromAttachment(): $$rhino.String;
/**
* Gets SHA1 Hex checksum for the attachment identified by the attachmentSysId parameter in the class initialization.
* @return {$$rhino.String} SHA1 Hex checksum string
*/
getSHA1HexChecksumFromAttachment(): $$rhino.String;
/**
* Gets SHA256 Hex checksum for the attachment identified by the attachmentSysId parameter in the class initialization.
* @return {$$rhino.String} SHA256 HEx checksum string
*/
getSHA256HexChecksumFromAttachment(): $$rhino.String;
type: "AttachmentUtils";
}
/**
* This script does availability calculation given a start and an end date, it considers the availability as well as maintenance commitments
* along with the schedules attached to the offering.
*/
export class AvailabilityCalculator {
SCHEDULES: GlideLRUCache;
cmdb_ci: string | null;
commitment: string | null;
sumCount: number;
constructor();
calculate(start: GlideDateTime, end: GlideDateTime, type: service_availabilityType): void;
setCommitment(id: string): void;
setCI(cmdb_ci: string): void;
}
export class AvailabilityRecord {
type : service_availabilityType;
constructor(cmdb_ci: $$rhino.String, start: GlideDateTime, end: GlideDateTime);
post(commitment: $$rhino.String, absolute: GlideDuration, scheduled: GlideDuration, absolute_avail: $$rhino.Number, scheduled_avail: $$rhino.Number, absolute_count: $$rhino.Number,
scheduled_count: $$rhino.Number, ast: GlideDuration, mtbf: GlideDuration, mtrs: GlideDuration, allowed: GlideDuration, met: $$rhino.Boolean): void;
setType(t: service_availabilityType): void;
}
export class AvailabilitySummarizer {
cmdb_ci: string | null;
commitment: string | null;
start: GlideDateTime;
constructor();
summarize(start?: string | GlideDateTime): void;
setCommitment(id: string): void;
setCI(cmdb_ci: string): void;
}
/**
* Utility for Calendar
*/
export class CalendarUtils {
static readonly UTC_DATE_FORMAT = "yyyy-MM-dd";
static readonly UTC_TIME_FORMAT = "HH:mm:ss";
log: GSLog;
/**
* Creates an instance of CalendarUtils.
*/
constructor();
/**
* Get date format from user defined format or system format if not found, but converted to DHTMLX format as per spec:
* {@link http://docs.dhtmlx.com/scheduler/settings_format.html}
* @return {string} DHTMLX user date format or system date format.
*/
getUserDateFormat(): string;
/**
* Get time format from user defined format or system format if not found, but converted to DHTMLX format as per spec:
* {@link http://docs.dhtmlx.com/scheduler/settings_format.html}
* @return {string} DHTMLX user time format or system time format.
*/
getUserTimeFormat(): string;
type: "CalendarUtils";
}
/**
* For a given system property which lists out supported content types, this Script Inlcude checks to make sure the associated attachment stored (passed into class as a GlideRecord) has the correct content_type.
*/
export class ContentTypeValidator {
defaultSupportedContentTypes: "image/svg+xml";
constructor();
isValidType(attachment: GlideRecord, userDefinedSupportedContentTypes?: string[]): boolean;
}
export class CurrencyConversionTableList {
constructor();
process(): string[];
type: "CurrencyConversionTableList";
}
/**
* Core methods to get a default list of encryptable fields, meant to be leveraged by both Edge and Column Level Encryption.
*/
export class EncryptionCommons {
constructor();
/**
* Lists all fields that can be encrypted for a given table.
* @param {string} tableName - The name of the table.
* @param {{ (ed: GlideElementDescriptor, fieldName: $$rhino.String, ec?: EncryptionCommons): boolean }} [additionalValidator] - Validator that returns true if the field can be encrypted.
* @return {$$rhino.String[]} Name sof encryptable fields for the given table.
*/
getEncryptableFieldsForTable(tableName: string, additionalValidator?: { (ed: GlideElementDescriptor, fieldName: $$rhino.String, ec: EncryptionCommons): boolean }): $$rhino.String[];
addToArrayTablesWithBooleanAttributeSetToTrue(array: $$rhino.String[], attributeName: $$rhino.String): $$rhino.String[];
/**
* Tests whether table is marked for auditing.
* @param {string} tableName - The name of the table.
* @return {boolean} True if the table is marked for auditing; otherwise, false.
*/
isTableAudited(tableName: string): boolean;
getUsableCryptoModules(): $$rhino.String[];
type: "EncryptionCommons";
}
/**
* Choice list for job type field based on user session and 'glide_encryption.cle_replatforming_with_kmf'
*/
export class EncryptionJobTypeChoices {
constructor();
process(): GlideChoiceList;
type: "EncryptionJobTypeChoices";
}
export class GlideCryptoModule {
static get(): GlideCryptoModule;
static getModule(cryptoModuleName: $$rhino.String): GlideCryptoModule;
CRYPTO_MODULE: sn_kmf_ns.KMFCryptoModule | null;
constructor(cryptoModule: sn_kmf_ns.KMFCryptoModule);
encryptData(data: $$rhino.String): $$rhino.String;
wrapKeyFromBytes(data: $$rhino.String): $$rhino.String;
wrapKeyFromBytesForAlgorithm(data: $$rhino.String, algorithm: $$rhino.String): $$rhino.String;
wrapKeyFromSysId(data: $$rhino.String): $$rhino.String;
decryptData(data: $$rhino.String): $$rhino.String;
unwrapKey(data: $$rhino.String): $$rhino.String;
unwrapKeyForAlgorithm(data: $$rhino.String, algorithm: $$rhino.String): $$rhino.String;
generateMac(data: $$rhino.String): $$rhino.String;
verifyMac(data: $$rhino.String, expectedMac: $$rhino.String): $$rhino.Boolean;
asymmetricEncryptData(data: $$rhino.String): $$rhino.String;
asymmetricWrapKeyFromBytes(data: $$rhino.String): $$rhino.String;
asymmetricWrapKeyFromBytesForAlgorithm(data: $$rhino.String, algorithm: $$rhino.String): $$rhino.String;
asymmetricWrapKeyFromSysId(data: $$rhino.String): $$rhino.String;
asymmetricDecryptData(data: $$rhino.String): $$rhino.String;
asymmetricUnwrapKey(data: $$rhino.String): $$rhino.String;
asymmetricUnwrapKeyForAlgorithm(data: $$rhino.String, algorithm: $$rhino.String): $$rhino.String;
sign(data: $$rhino.String): $$rhino.String;
verifySignature(data: $$rhino.String, signature: $$rhino.String): $$rhino.Boolean;
discard(): void;
type: "GlideCryptoModule";
}
/**
* The GlideQuery API is an alternative to GlideRecord to perform CRUD operations on record data from server-side scripts.
* @see {@link https://developer.servicenow.com/dev.do#!/reference/api/utah/server/no-namespace/GlideQueryAPI}
* @see {@link https://docs.servicenow.com/bundle/utah-api-reference/page/app-store/dev_portal/API_reference/GlideQuery/concept/GlideQueryGlobalAPI.html}
*/
export class GlideQuery {
/**
* Instantiates a GlideQuery object used to build and execute record queries.
* @param {$$rhino.String} table - Name of table to query.
*/
constructor(table: $$rhino.String);
/**
* Aggregates a field using a specified aggregation function.
* @param {$$rhino.String} aggregateType - The type of aggregation function to perform.
* @param {$$rhino.String} field - Field on which to perform the operation.
* @return {GlideQuery} The query object being built.
* @description Use this method to build queries that aggregate against multiple fields or use multiple aggregate functions,
* or if you must use the {@link #groupBy()} method. If you only want to aggregate against one field with one function,
* and you don't need to use {@link #groupBy()}, then use {@link #avg()}, {@link #min()}, {@link #max()} or {@link #count()}, instead.
*/
aggregate(aggregateType: AggregateType, field: $$rhino.String): GlideQuery;
/**
* Returns the aggregate average of a given numeric field.
* @param {$$rhino.String} field - Field on which to perform the operation.
* @return {Optional<$$rhino.Number>} Object that contains the aggregate average of the given field.
* @description You can only use this method on Integer, Long, Floating Point Number, Double and Currency fields.
*/
avg(field: $$rhino.String): Optional<$$rhino.Number>;
/**
* Returns the number of records that match the query.
* @return {$$rhino.Number} Number of records that match the query.
*/
count(): $$rhino.Number;
/**
* Deletes all records in the table specified by the preceding Where clauses.
*/
deleteMultiple(): void;
/**
* Disables updating system fields, or fields with a name that starts with the sys prefix, such as sys_created_on, sys_updated_on, and sys_mod_count.
* Only applies to the specified query.
* @return {GlideQuery} The query object being built.
*/
disableAutoSysFields(): GlideQuery;
/**
* Disables any business rules, flows, workflows, or audit records that would run or be created as the result of the query.
* @return {GlideQuery} The query object being built.
*/
disableWorkflow(): GlideQuery;
/**
* Forces a database update even when no record changes are made. For example, you can use this method to force a business rule to execute.
* @return {GlideQuery} The query object being built.
*/
forceUpdate(): GlideQuery;
/**
* Returns a single record from the query.
* @param {$$rhino.String} key - Sys_id of the record to return.
* @param {$$rhino.String[]} [selectedFields] - Optional additional fields to return in the result.
* The system always returns the sys_id.
* @return {Optional<{ [key: string]: $$rhino.String; }>} Object used to interact with a single record.
*/
get(key: $$rhino.String, selectedFields?: $$rhino.String[]): Optional<{ [key: string]: $$rhino.String; }>;
/**
* Returns an Optional object containing a single record based on a set of name-value pairs to query by.
* Assumes the '=' operator for each name-value pair.
* @param {{ [key: string]: any; }} keyValues - Object where the keys are the name of the fields, and the values are the values to query for.
* @param {$$rhino.String[]} [selectedFields] - Optional additional fields to return in the result.
* The system always returns the sys_id.
* @return {Optional<{ [key: string]: $$rhino.String; }>} Object used to interact with a single record.
*/
getBy(keyValues: { [key: string]: any; }, selectedFields?: $$rhino.String[]): Optional<{ [key: string]: $$rhino.String; }>;
/**
* Groups the query results by a designated field or fields.
* @param {($$rhino.String | $$rhino.String[])} fields - Field or fields to group the results by.
* @return {GlideQuery} The query object being built.
* @description You must use this method with the {@link #aggregate} method.
*/
groupBy(fields: $$rhino.String | $$rhino.String[]): GlideQuery;
/**
* Filters aggregate groups so that you can display only groups of results that match a specified condition.
* @param {AggregateType} aggregateType - The type of aggregation function to perform.
* @param {$$rhino.String} field - Field on which to perform the operation.
* @param {NumberQueryOperator} operator - Numeric operator to use in the operation.
* @param {$$rhino.Number} value - Number value to use in the operation.
* @return {GlideQuery} The query object being built.
*/
having(aggregateType: AggregateType, field: $$rhino.String, operator: NumberQueryOperator, value: $$rhino.Number): GlideQuery;
/**
* Inserts a record and returns an Optional object containing the record.
* @param {{ [key: string]: any; }} keyValues - Object containing name-value pairs to insert into the record. Unspecified fields will be null.
* @param {$$rhino.String[]} [selectedFields] - Optional additional fields to return in the result.
* The system always returns the sys_id.
* @return {Optional<{ [key: string]: $$rhino.String; }>} Object used to interact with a single record.
*/
insert(keyValues: { [key: string]: any; }, selectedFields?: $$rhino.String[]): Optional<{ [key: string]: $$rhino.String; }>;
/**
* Updates an existing record, or inserts a new record if one does not already exist.
* @param {{ [key: string]: any; }} changes - Object containing name-value pairs to update or insert into the record.
* @param {$$rhino.String[]} [selectedFields] - Optional additional fields to return in the result.
* The system always returns the sys_id.
* @return {Optional<{ [key: string]: $$rhino.String; }>} Object used to interact with a single record.
*/
insertOrUpdate(changes: { [key: string]: any; }, selectedFields?: $$rhino.String[]): Optional<{ [key: string]: $$rhino.String; }>;
/**
* Limits the number of records returned in a query.
* @param {$$rhino.Number} limit - Number of records to return.
* @return {GlideQuery} The query object being built.
*/
limit(limit: $$rhino.Number): GlideQuery;
/**
* Returns the aggregate maximum of a given field.
* @param {$$rhino.String} field - Field on which to perform the operation.
* @return {Optional<$$rhino.String>} Object used to interact with a single record.
*/
max(field: $$rhino.String): Optional<$$rhino.String>;
/**
* Returns the aggregate minimum of a given field.
* @param {$$rhino.String} field - Field on which to perform the operation.
* @return {Optional<$$rhino.String>} Object used to interact with a single record.
*/
min(field: $$rhino.String): Optional<$$rhino.String>;
/**
* Orders the returned result in ascending order by a given field.
* @param {$$rhino.String} fields - Comma-delimited fields to order the result by in ascending order.
* @return {GlideQuery} The query object being built.
*/
orderBy(fields: $$rhino.String): GlideQuery;
/**
* Orders the returned result in descending order by a given field.
* @param {$$rhino.String} fieldOrAggregate - If the query does not use the aggregate() method, pass the field to order the results by.
* If the query uses the {@link #aggregate} method, pass the type of aggregation function ({@link AggregateType}) to perform.
* @param {$$rhino.String} field - Field on which to perform the operation.
* @return {GlideQuery} The query object being built.
*/
orderByDesc(fieldOrAggregate: $$rhino.String, field: $$rhino.String): GlideQuery;
/**
* Adds an OR clause to a query that returns values based on a given condition.
* @param {($$rhino.String | GlideQuery)} fieldOrQuery - Field or another GlideQuery object used in the where clause.
* If passing a field, you can dot-walk to a desired value.
* @param {$$rhino.Nilable<QueryOperator>} operator - Optional operator used in the where clause.
* If you do not pass an argument, the system uses the = operator.
* @param {*} value - Value used in the where clause.
* @return {GlideQuery} The query object being built.
*/
orWhere(fieldOrQuery: $$rhino.String | GlideQuery, operator: $$rhino.Nilable<QueryOperator>, value: any): GlideQuery;
/**
* Adds an OR clause that returns records that do not contain a null value in a given field.
* @param {$$rhino.String} field - Field on which to perform the operation.
* @return {GlideQuery} The query object being built.
*/
orWhereNotNull(field: $$rhino.String): GlideQuery;
/**
* Adds an OR clause to a query that returns records that contain a null value in a given field.
* @param {$$rhino.String} field - Field on which to perform the operation.
* @return {GlideQuery} The query object being built.
*/
orWhereNull(field: $$rhino.String): GlideQuery;
/**
* Returns the results of the query as a Stream object containing the specified fields.
* @param {($$rhino.String | $$rhino.String[])} fields - Fields to display in the result.
* You can provide any number of fields as arguments, dot-walk to a desired value, or use a flag.
* @return {Stream<{ [key: string]: $$rhino.String; }>} Object used to interact with a stream of items such as records.
* @description You can append a flag to a field name to return the field's metadata instead of the field's value.
* For example, using the field name company$DISPLAY returns the display value of a company field. Possible flags include:
* DISPLAY=Returns the display value of a field;
* CURRENCY_CODE=Returns the currency code of a currency field;
* CURRENCY_DISPLAY=Returns the currency display value of a currency field;
* CURRENCY_STRING=Returns the currency string of a currency field.
*/
select(fields: $$rhino.String | $$rhino.String[]): Stream<{ [key: string]: $$rhino.String; }>;
/**
* Returns the result of the query as an Optional object containing specified fields.
* @param {$$rhino.String} [fields] - Fields to display in the result.
* You can provide any number of fields as arguments, dot-walk to a desired value, or use a flag.
* @return {Optional<{ [key: string]: $$rhino.String; }>} Object used to interact with a single record.
* @description You can append a flag to a field name to return the field's metadata instead of the field's value.
* For example, using the field name company$DISPLAY returns the display value of a company field. Possible flags include:
* DISPLAY=Returns the display value of a field;
* CURRENCY_CODE=Returns the currency code of a currency field;
* CURRENCY_DISPLAY=Returns the currency display value of a currency field;
* CURRENCY_STRING=Returns the currency string of a currency field.
*/
selectOne(fields?: $$rhino.String): Optional<{ [key: string]: $$rhino.String; }>;
/**
* Returns the aggregate sum of a given numeric field.
* @param {$$rhino.String} field - Field on which to perform the operation.
* @return {Optional<$$rhino.Number>} Object used to interact with a single record.
* @description You can only use this method on Integer, Long, Floating Point Number, Double and Currency fields.
*/
sum(field: $$rhino.String): Optional<$$rhino.Number>;
/**
* Returns a GlideRecord or GlideAggregate object that represents the current query.
* @return {(GlideRecord | GlideAggregate)} GlideRecord or GlideAggregate object that contains the query.
* @description After transforming the query, use the query() method in the GlideRecord or GlideAggregate classes to query the database.
*/
toGlideRecord(): GlideRecord | GlideAggregate;
/**
* Updates an existing record that matches the defined conditions.
* @param {{ [key: string]: any; }} changes - Object containing name-value pairs to update in the record. Names must match fields in the table.
* @param {$$rhino.String[]} [selectedFields] - Optional additional fields to return in the result.
* The system always returns the sys_id.
* @return {Optional<{ [key: string]: $$rhino.String; }>} Object used to interact with a single record.
*/
update(changes: { [key: string]: any; }, selectedFields?: $$rhino.String[]): Optional<{ [key: string]: $$rhino.String; }>;
/**
* Updates all existing records that match the defined conditions. Returns the number of records updated.
* @param {{ [key: string]: any; }} changes - Object containing name-value pairs to update in the record. Names must match fields in the table.
* @return {{ rowCount: $$rhino.Number; }} Object containing the number of records that were updated.
*/
updateMultiple(changes: { [key: string]: any; }): { rowCount: $$rhino.Number; };
/**
* Adds a Where clause to the query that returns values based on a given condition.
* @param {($$rhino.String | GlideQuery)} fieldOrQuery - Field or another GlideQuery object used in the where clause.
* @param {$$rhino.Nilable<$$rhino.String>} operator - Optional operator used in the where clause.
* If you do not pass an argument, the system uses the = operator.
* @param {*} value - Value used in the where clause.
* @return {GlideQuery} The query object being built.
* @description Do not precede this method with the {@link #orWhere}, {@link #orWhereNull}, or {@link #orWhereNotNull} methods.
*/
where(fieldOrQuery: $$rhino.String | GlideQuery, operator: $$rhino.Nilable<$$rhino.String>, value: any): GlideQuery;
/**
* Returns records that do not contain a null value in a given field.
* @param {$$rhino.String} field - Field used in the query.
* @return {GlideQuery} The query object being built.
* @description Do not precede this method with the {@link #orWhere}, {@link #orWhereNull}, or {@link #orWhereNotNull} methods.
*/
whereNotNull(field: $$rhino.String): GlideQuery;
/**
* Returns records that do not contain a null value in a given field.
* @param {$$rhino.String} field - Field used in the query.
* @return {GlideQuery} The query object being built.
* @description Do not precede this method with the {@link #orWhere}, {@link #orWhereNull}, or {@link #orWhereNotNull} methods.
*/
whereNull(field: $$rhino.String): GlideQuery;
/**
* Executes the query using the GlideRecordSecure API to securely query the database while honoring ACLs.
* @return {GlideQuery} The query object being built.
*/
withAcls(): GlideQuery;
type: "GlideQuery";
}
/**
* @todo Document global.GlideQueryActions
*/
export class GlideQueryActions {
// TODO: Add members for global.GlideQueryActions from https://usmskdev2.servicenowservices.com/nav_to.do?uri=sys_script_include.do?sys_id=89cffabe29300010fa9b76addd33871b
type: "GlideQueryActions";
}
/**
* @todo Document global.GlideQueryEvaluator
*/
export class GlideQueryEvaluator {
// TODO: Add members for global.GlideQueryEvaluator from https://usmskdev2.servicenowservices.com/nav_to.do?uri=sys_script_include.do?sys_id=d52b3c8a08013300fa9b4300d8d67a76
type: "GlideQueryEvaluator";
}
/**
* Utility class for working with GlideRecords.
* @see {@link https://docs.servicenow.com/bundle/utah-api-reference/page/app-store/dev_portal/API_reference/GlideRecordUtil/concept/c_GlideRecordUtilAPI.html}
* @see {@link https://developer.servicenow.com/dev.do#!/reference/api/utah/server_legacy/c_GlideRecordUtilAPI}
*/
export class GlideRecordUtil {
/**
* Returns the GlideRecord object for the specified configuration item (CI) using just the sys_id of the CI.
* Use this method to quickly obtain a specific CI without knowing its associated class/table.
* @param {string} sys_id - Sys_id of the desired CI.
* @return {(GlideRecord | undefined)} GlideRecord object of the specified CI.
*/
getCIGR(sys_id: string): GlideRecord | undefined;
/**
* Returns an array of all the fields in the specified GlideRecord.
* Note: If there is a field name which is the same as the table name, the getFields() method does not return the value of the field.
* @param {GlideRecord} gr - GlideRecord instance positioned to a valid record.
* @return {string[]} Field names for the specified GlideRecord.
*/
getFields(gr: GlideRecord): string[];
/**
* Returns a GlideRecord instance for the given table, positioned to the given sys_id, and of the right class (table).
* This method is useful when you need to load a GlideRecord from a sys_id, but you don't know what the actual table is (because it may be extended from the base table).
* This method always returns a GlideRecord of the correct type base_table: the name of the base table that the specified sys_id is in.
* @param {string} baseTable - The name of the base table containing the sys_id.
* @param {string} sys_id - The sys_id of the desired record.
* @return {(GlideRecord | null)} The GlideRecord for the specified sys_id or null it not found.
*/
getGR(baseTable: string, sys_id: string): GlideRecord | null;
/**
* Returns a Java ArrayList of the ancestors of the specified table name.
* @param {string} tableName - Name of the table.
* @return {Packages.java.util.ArrayList<Packages.java.lang.String>} List of ancestors of the specified table.