Need help with Catalog Client Script

Hritik
Tera Expert

Hi Community,

 

I need help in developing client script. 

Please consider below scenario:

 

When I select "Singapore" as a choice from the field "Please select the region you are in:" 

Hritik_0-1700139116415.png

 

Then the records in field "Please select the Service you are having issue with:" must only start from SGP.

 

The field "Please select the Service you are having issue with:" is a Reference field to cmdb_ci table.

 

Please help me construct a On Change Client Script that modifies the data i.e starts with SGP .

 

 

Thanks in Advance,

Hritik.

 

  

1 ACCEPTED SOLUTION

Hi @Hritik 

Okay there you go! 😋

 

javascript:"operational_status=1^sys_class_name=cmdb_ci_appl^ORsys_class_name=cmdb_ci_service^ORsys_class_name=cmdb_ci_service_technical^ORsys_class_name=cmdb_ci_service_business^nameSTARTSWITH" + current.variables.please_select_the_region_you_are_in.toString();

 

TaiVu_0-1700209730090.png

 

 

Cheers,

Tai Vu

View solution in original post

14 REPLIES 14

Peter Bodelier
Giga Sage

Hi @Hritik 

 

You can't do this with a Client script. You will need to use a reference qualifier on the second field.

You might be able to use something like this:

javascript: if(current.variables.region == 'Singapore'){'idSTARTSWITHSGP'};     

Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

Hi Peter,

 

They are two different fields. 

Where do I add the Reference Qualifier ?

 

Basically, the values in Field "Please select the Service you are having issue with:" must be dependent on the selection of field "Please select the region you are in:" 

You would need to add it in the Service field record for example like this in the Reference Qualifier field:

PeterBodelier_0-1700140007625.png

 

 

 

 

 

 

 

 

The example I provided is of course for just one selection. If you will need a lot, it would be better to use a script include instead. But first let's see if this works for you.


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

Hi Peter,

 

I added below ref qualifier, but it's showing all the records. Not working.

Hritik_0-1700141109106.png

 

 

Also, there are 17 choices , so we would need to create script include. 

Could you please suggest how can we create script include ?