reference qualifier conditions based on form view.

si21
Tera Guru

Hi experts,

We have a requirement to apply reference qualifier for a reference field based on for form view. We have 2 views for location table say A & B. The reference qualifier specified on the Dictionary entry should be applicable only for view A and not on B.

 I have already checked the exact similar question in community but didn't find the solution. Solved: Re: Reference Qualifier based on Form View - ServiceNow Community

 

How can we achieve this.

 

TIA.

1 ACCEPTED SOLUTION

Vasantharajan N
Giga Sage
Giga Sage

@si21  - Please update the encoded string and form view then try. Please make sure this change should not have any impact to other table that has reference to the locations table which is one of the foundation data. 

 

javascript: gs.action.getGlideURI().getMap().get('sysparm_form_view') == 'view A' ? 'encoded query string to apply for view A' : 'encoded query string to apply for view B'


Thanks & Regards,
Vasanth

View solution in original post

5 REPLIES 5

Uncle Rob
Kilo Patron

The problem is that you've created two views instead of two roles.  
At the core is the idea that two populations of users can do two different things.
That should be ROLE based, NOT view based.

Vasantharajan N
Giga Sage
Giga Sage

@si21  - Please update the encoded string and form view then try. Please make sure this change should not have any impact to other table that has reference to the locations table which is one of the foundation data. 

 

javascript: gs.action.getGlideURI().getMap().get('sysparm_form_view') == 'view A' ? 'encoded query string to apply for view A' : 'encoded query string to apply for view B'


Thanks & Regards,
Vasanth

Hi @Vasantharajan N , thank you for the script It's working fine. I have small doubt here where do we add view B in the above script.

and what If I have more than two views on the form. Could you please help me here. Thanks

Hi @si21 - You may define a script include to assess the different form view which you wanted to assess and return the right encoded query.


Thanks & Regards,
Vasanth