Reference qualifier applying on reports

Dubz
Mega Sage

Hi All,

On my Problem form I have a simple reference qualifier operating on a field referencing the company table. When i'm running reports on the Problem table, if i want to add a condition based on this field the reference qualifier is ignored and i'm given all records from the companies table rather than the subset defined by the reference qualifier.

Is there a way to make the fields on reports take account of the reference qualifiers that have been set on them on the table?

1 ACCEPTED SOLUTION

Yes, this is the servicenow behavior. The reference qualifiers doesn't applies on the report. Actually this is a global behavior and it is not feasible to set the before query for all. If there is one or two case then it can be managed with script. I will not recommend to write script for your case.



Regards


Harsh


View solution in original post

6 REPLIES 6

Hi Aishwarya

You do not need to retrun anything in the business rule. just create a before query business rule and in the script add an addQuery() or addEncodedQuery() function with your query. See the below example.

Lets say, you want to restrict ITIL user to see security related incident records.

- Create a new business rule on incident table

- Check advanced checkbox true

-  Select When as before

-  Check query checkbox true

- in the script write below 

if (gs.hasRole('itil'))
current.addEncodedQuery("category!=Security");

This is just a simple example. Use business rule condition to add your required condition. Just make sure this script does not impact others.

Thank you very much Harsh !!!