MRVS Reference Qualifier Not Able to Access Parent Catalog Variable in Service Portal

NikhithaNikki
Tera Contributor

Hi Community,

I am working on a Catalog Item in Service Portal and need help filtering a reference variable inside an MRVS based on a catalog variable outside the MRVS.

Requirement

 

I have a catalog variable outside the MRVS:

 

Select Manager of Team (select_manager_of_team)
Reference to sys_user

 

Inside the MRVS, I have a reference variable:

 

Select Employee
Reference to sys_user

 

I need the Employee field to show only users whose manager is the manager selected in select_manager_of_team.

3 REPLIES 3

Tanushree Maiti
Tera Patron

Hi @NikhithaNikki 

 

To access catalog item variable from MRVS , use

 

 g_service_catalog.parent.getValue('item_parent_variable'); //replace actual variable name of your catalog item

 

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti

Ankur Bawiskar
Tera Patron

@NikhithaNikki 

So variable within MRVS should have reference qualifier based on outside variable

yes this is possible you can access outside variable in reference qualifier of MRVS variable

see these links for help

SOLVED: Issue with MRVS multi row variable set accessing the form values 

Yes, You Can Effectively Set or Update a Reference Qualifier Via Script! 

OR
Another easy approach

1) create a hidden single line text variable within MRVS and hide it always using UI policy of higher order

2) use onLoad catalog client script which runs on MRVS and set this hidden variable with outside variable

function onLoad() {
    g_form.setValue('hiddenVariable', g_service_catalog.parent.getValue("select_manager_of_team"));
}

3) now you have outside variable value available within MRVS and you can apply ref qualifier on your variable like this

javascript: 'manager=' + current.variables.hiddenVariable;

Note: remove : and use : in above comment, community posts has this issue from long time it replaces colon with :

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

@NikhithaNikki 

Just following up to see whether my suggested solution worked for you.

If you're still facing any issues, I'd be happy to help further.

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader