File tree Expand file tree Collapse file tree 4 files changed +28
-0
lines changed
Scripted REST Api/Get_Choices Expand file tree Collapse file tree 4 files changed +28
-0
lines changed Original file line number Diff line number Diff line change
1
+ # This code will help to query choice table and get the data according to filter. Modify this according to requirement
2
+ # References
3
+ - Below is the reference of PDI, what is the configuration of choices
4
+ ![ scripted_rest_resource.png] ( scripted_rest_resource.png )
5
+ - Below is the referecnce of PDI resources of Script
6
+ ![ script.png] ( script.png )
Original file line number Diff line number Diff line change
1
+ ( function process ( /*RESTAPIRequest*/ request , /*RESTAPIResponse*/ response ) {
2
+
3
+ var queryParams = request . queryParams ;
4
+
5
+ var grChoice = new GlideRecord ( 'sys_choice' ) ;
6
+ grChoice . addQuery ( 'name' , queryParams . name ) ;
7
+ grChoice . addQuery ( 'element' , queryParams . element ) ;
8
+ grChoice . query ( ) ;
9
+
10
+ var filterList = [ ] ;
11
+ while ( grChoice . next ( ) ) {
12
+ var label = grChoice . getValue ( "label" ) ;
13
+ var value = grChoice . getValue ( "value" ) ;
14
+ var object = {
15
+ code : value ,
16
+ country : label
17
+ } ;
18
+ filterList . push ( object ) ;
19
+ }
20
+
21
+ return filterList ;
22
+ } ) ( request , response ) ;
You can’t perform that action at this time.
0 commit comments