How to populate variable value automatically based on MRVS on catalog item
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2025 12:16 AM - edited 03-06-2025 05:44 AM
Hi Team,
I have MVRS named User details, and one variable called "employee details". so based on user details from MVRS , employee details field outside MVRS should be auto populated.
Any solutions on this ...
For Example, if i add two rows in Multi-Row Variable set,
User | Manager | |
Amul | a@gmail.com | Hari |
Bharath | b@gmail.com | Mahesh |
User column data should be autopopulated on "Employee Details" variable which is on catalog form.
Thanks,
Apoorva
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2025 12:29 AM
Hi @AA66
Did you try the OOTB, Auto populate feature in 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]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2025 12:30 AM
Hi @AA66
Can you help to be more specific on what exactly are we gonna fill into the Employee Details? Providing example of expected value to be populated would be great.
Cheers,
Tai Vu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2025 05:39 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2025 08:39 PM
Hi @AA66
You can achieve this by using an onSubmit script to populate the "Employee Details" field based on the User Details MRVS. Example below:
function onSubmit() {
var mrvsUsers = JSON.parse(g_form.getValue('user_details'));
var users = [];
for (var i in mrvsUsers) {
users.push(mrvsUsers[i].user);
}
g_form.setValue('employee_details', users.join(','));
}
Additionally, consider setting the Employee Details field to read-only since it's autofilled from another field.
I'm still curious about the business need here. Since we can already reference the User data from the MRVS, is there a specific reason to duplicate it in another variable?
Cheers,
Tai Vu