How can we show incident reference field to filtered incidents where they are the requested for / requested by on survey .

archie5
Tera Expert

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

1 ACCEPTED SOLUTION

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

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

View solution in original post

6 REPLIES 6

alexander buerk
Tera Contributor

Hello Ankur,

Is there also a way to do this in the Survey Portal Widget? 

In the Widget the BR dont work. 

var url = gs.action.getGlideURI().getMap().get('sysparm_target');

is always 'null'

Regards

Alexander

Hi,

Yes I have come across this situation wherein the getGlideURI() doesn't work well in portal.

What error it shows in system logs

Regards
Ankur

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