- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2019 09:04 AM
Hello All,
On survey form, we have a question which is a reference to the incident table. where we have to display incidents only requested for and opened by is logged in user.
It is mentioned on ServiceNow docs page that for reference type ref qualifiers doesn't work.
https://docs.servicenow.com/bundle/newyork-servicenow-platform/page/administer/survey-administration/concept/c_SurveyDesignerElements_1.html
Is there any other way of doing it?
Appreciate your response.
Archie
Solved! Go to Solution.
- Labels:
-
User Interface (UI)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2019 07:44 AM
Hi Archie,
you can apply query business rule on incident table and restrict it to run only when somebody opens incident table from the survey page and not from the native UI
business rule: before query
table: incident
script:
var url = gs.action.getGlideURI().getMap().get('sysparm_target');
if(url.indexOf('ASMTQUESTION') >= 0){
var query = 'opened_by=' + gs.getUserID()+ '^requested_for=' + gs.getUserID();
current.addEncodedQuery(query);
}
What the script does is checks whether the url contains ASMTQUESTION; if yes then it means it is survey page; then only run the query business rule
the above business rule won't run for native UI
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2019 02:13 AM
Hi Archie,
Yes that's correct for reference type of question on Survey you cannot apply reference qualifier
you can use below approach
1) use query business rule on that table which is being referred but that will execute whenever normal user opens incident list in native UI as well;
var query = 'opened_by=' + gs.getUserID()+ '^requested_for=' + gs.getUserID();
current.addEncodedQuery(query);
I will look and check any other option as well
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2019 09:31 PM
Thanks Ankur for your response!
Is there any other way that doesn't affect the native UI?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2019 07:44 AM
Hi Archie,
you can apply query business rule on incident table and restrict it to run only when somebody opens incident table from the survey page and not from the native UI
business rule: before query
table: incident
script:
var url = gs.action.getGlideURI().getMap().get('sysparm_target');
if(url.indexOf('ASMTQUESTION') >= 0){
var query = 'opened_by=' + gs.getUserID()+ '^requested_for=' + gs.getUserID();
current.addEncodedQuery(query);
}
What the script does is checks whether the url contains ASMTQUESTION; if yes then it means it is survey page; then only run the query business rule
the above business rule won't run for native UI
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2019 08:30 PM
Hi Archie,
Can you also mark answer as helpful
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader