Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

Reference qualifier for MRVS

deekshithkd
Kilo Explorer

I have a requirement here, where I have two fields, one is a  "select the group" field referencing to group table which is in the main form and another field called "user", referencing the user table which is inside the MRVS, and one more thing, every user in the user table has 2 records, for example, someone called James, he has two ids, with same name, like

James - GFRTY

James - A_GFRTY, 

This is for most of the users.

 

Now, if someone selects any group in the Group field, and if the selected group has "Zen" in the group name, then I need to write a reference qualifier to the user field inside the MRVS, like if the selected group has "Zen" in the group name, then I need to write a reference qualifier in the user field inside the MRVS, to show only the user names that has the ids with A_ and not the normal ids, for example, 

 

If the selected group name is "Integration zen support" or "MFA zen admins", then I need to show only the names with the ids that Starts with A_.

 

Can someone say how can we achieve this, is there any way for this.

1 REPLY 1

pavani_paluri
Tera Guru

Hi @deekshithkd ,

 

On the User field inside the MRVS, set up an Advanced Reference Qualifier.
In that qualifier, write a small script that:
Looks at the selected group’s name.
If the name includes “Zen”, it filters the user list to only those IDs starting with A_.
Otherwise, it doesn’t filter anything (so all users show up)
Check the group name. If it has ‘Zen’, then only allow users whose ID begins with A_. If not, allow everyone.
var groupName = current.variables.group.getDisplayValue(); // Adjust depending on your form setup
var answer = '';

if (groupName && groupName.toLowerCase().indexOf('zen') > -1) {
// Only return users with sys_id starting with A_
answer = 'user_idSTARTSWITHA_';
} else {
// Default: return all users
answer = '';
}

return answer;

 

Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Pavani P