How to populate variable value automatically based on MRVS on catalog item

AA66
Tera Contributor

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 ...

 

 

 

AA66_1-1741248793058.jpeg

For Example, if i add two rows in Multi-Row Variable set,  

UserEmailManager
Amula@gmail.comHari
Bharathb@gmail.comMahesh

User column data should be autopopulated on "Employee Details" variable which is on catalog form.

 

Thanks,

Apoorva

 

5 REPLIES 5

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @AA66 

 

Did you try the OOTB,  Auto populate  feature in variable,

 

AGLearnNGrow_0-1741249738010.png

 

*************************************************************************************************************
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]

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

Tai Vu
Kilo Patron
Kilo Patron

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

AA66
Tera Contributor

Hi @Tai Vu ,

 

I have updated my question, please check

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