Catalog Item fields

GBS
Tera Contributor

I have 3 fields in a catalog form. They are User Role, Hardware Bundle and Software Bundle. When the requested for is selected the values of User Role, Hardware bundle and Software Bundle have to auto-populate based on the Requested for. How to achieve this. 

2 ACCEPTED SOLUTIONS

Here is the first script:

Please change the variable name:

function onChange(control, oldValue, newValue, isLoading) {
   if (isLoading || newValue == '') {
      return;
   }
     
		var user = g_form.getReference('Requested_for', gettitle);    
		function gettitle(user) {
        g_form.setValue('user_role', user.user_role);
    
}
   
}

 2. Please see the example script below. Please change the script as per your requirements:

function onChange(control, oldValue, newValue, isLoading) {
   if (isLoading || newValue == '') {
      return;
   }
		var role = g_form.getValue('user_role');
		if (role == 'sales'){
			g_form.setValue('Software', 'Windows 10, MS Office'); //In my example Software is a string field.
		}
    

   
}

 

If my response helped you, please mark it as correct or helpful.


If my response helped you, please click on "Accept as solution" and mark it as helpful.
- Saloni

View solution in original post

1st script - The variable name field should be set to Requested for

2nd script - The variable name field should be set to User Role.


If my response helped you, please click on "Accept as solution" and mark it as helpful.
- Saloni

View solution in original post

17 REPLIES 17

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @GBS 

 

If the Hardware / Software bundle on user table you can auto populate feature on catalog variable. 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

@Dr Atul G- LNG Hardware Bundle and Software bundle are not present in the user table

Hi @GBS 

 

In this script need to write to get the data as suggested by @Saloni Suthar 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************