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

Ankur Bawiskar
Tera Patron
Tera Patron

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

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

Thanks Ankur for your response!

Is there any other way that doesn't affect the native UI?

 

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

Hi Archie,

Can you also mark answer as helpful

Regards

Ankur

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