restrict the filter options on service catalog field

pavam
Tera Contributor

I am having a reference field on the Service catalog form,

 

below is the screenshot

pavam_0-1727677054982.png

 

  and  level 3 form field is like below.

 

pavam_1-1727678966962.png

 

 

 

 and coming to script include, through the Reference qual.

 

 businessGroup: function() {
          var choices = [];
        var gr = new GlideAggregate('u_ehs');
        gr.groupBy('u_business_group');
        gr.query();

        while (gr.next()) {
            gs.log(" level3 in si in loop" + gr.u_business_group);
            choices.push(gr.getValue('u_business_group').toString());

        }
        //return JSON.stringify(choices);
        return 'sys_idIN' + chocies;
    },
 
..
 
In level 3 , reference field , dropdown list should come like , what ever the values present in the custom table .
 
But  here i am getting all the values as dropdown list from the reference table(reference table , refere 2nd screen shot, table name: x_emel_dat_business_group.
 
My desired output is , values preset in table: u_ehs , should come as dropdown in the  catalog item reference field.
 
 Can some one help me regarding this.
Appreciated your help.
Thankyou.
1 ACCEPTED SOLUTION

Ravi Gaurav
Giga Sage

Hi @pavam 

 

Correct the Typo in the Script Include:
There’s a typo in chocies. It should be choices.
return 'sys_idIN' + choices;

can you revisit the script and modify it

businessGroup: function() {
var choices = [];
var gr = new GlideAggregate('u_ehs');
gr.groupBy('u_business_group');
gr.query();

while (gr.next()) {
gs.log("level 3 in SI in loop: " + gr.getValue('u_business_group'));
choices.push(gr.getValue('u_business_group').toString());
}

return 'u_business_groupIN' + choices.join(',');
},

View solution in original post

1 REPLY 1

Ravi Gaurav
Giga Sage

Hi @pavam 

 

Correct the Typo in the Script Include:
There’s a typo in chocies. It should be choices.
return 'sys_idIN' + choices;

can you revisit the script and modify it

businessGroup: function() {
var choices = [];
var gr = new GlideAggregate('u_ehs');
gr.groupBy('u_business_group');
gr.query();

while (gr.next()) {
gs.log("level 3 in SI in loop: " + gr.getValue('u_business_group'));
choices.push(gr.getValue('u_business_group').toString());
}

return 'u_business_groupIN' + choices.join(',');
},