Reporting on Records that match the Locations Covered

davidglover
Giga Expert

Hi folks!

We have a business need to display records based on physical locations (cmn_locations) in addition to the Assigned To/Group fields.   For example, a Facility Engineer will need to see Work Orders assigned to themselves along with all other Work Orders related to the location(s) they cover.

I am trying to find a way to leverage the User Location Coverage (sys_user_covers_location) table to return the locations and then filter a report that way.   Is anyone aware of a way of leveraging a JavaScript query in the report builder for locations?   What I was thinking is I could use JavaScript to return the location sys_ids, similar to a breadcrumb query, ex:

location=1b6b156013335e005c45b53a6144b080^ORlocation=d647f9aa13b0a24024d67e276144b04c^ORlocation=1154e9e013335e005c45b53a6144b064

Or is there a way to leverage the UI to select the Locations Covered table (screenshot below)?

Add Locations Covered.png

Thanks in advance!

David

1 ACCEPTED SOLUTION

srinivasthelu
Tera Guru

Screenshots of example



Capture.JPG



Capture 2.JPG


View solution in original post

7 REPLIES 7

srinivasthelu
Tera Guru

Hi David,



You are right!!, You can call a script include function from the filter with something like below and have that function returning sys_ids.



javascript: new ScriptInludeName().functionName()


Srinivas Balusu
Kilo Guru

Can you please let me know what table are you querying. I am not much into Facilities Management. Looks like you question is related to that.



OR


You can also use the technique below to use a dynamic value in the report condition fields.



Set Default Value for Reference Fields - ServiceNow Wiki


srinivasthelu
Tera Guru

Screenshots of example



Capture.JPG



Capture 2.JPG


Srinivas,



Thank you for the details and screenshots, much appreciated.   My script is working as expected and has been tested in a fix script.   The issue I seem to have now is I do not have the 'IN' operator available to select in the Filter Condition builder.   I'm using some Googlefoo to try to figure out why it's missing...



No In Operator.png



Thanks,


David