- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2024 05:29 AM
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.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2024 07:16 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2024 08:27 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2024 07:16 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2024 07:33 AM
@Saloni Suthar do I have to create catalog client script or Client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2024 07:34 AM
Catalog Client script
If my response helped you, please click on "Accept as solution" and mark it as helpful.
- Saloni
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2024 08:10 AM - edited 02-15-2024 08:11 AM
@Saloni Suthar any changes to be made?
back end value of User Role field in user table is u_user_role
Have to create any script include?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2024 08:18 AM
Yes please modify the script and update the field names with what you have in your instance.
No you do not need script include.
If my response helped you, please click on "Accept as solution" and mark it as helpful.
- Saloni