Make location inactive?

Heather White
Mega Guru

Good morning,

      Is there a way to make locations inactive in ServiceNow?   We imported current(updated) locations from AD and users now have the correct locations within their company.   However, the "old" locatoins are still available in the drop down menu.   We do not want users to see these depricated locations.

Thank you!

Heather

1 ACCEPTED SOLUTION

Chuck Tomasi
Tera Patron

Hi Heather,



Here's how I would handle this - without deleting any of the previous records, because deleting can cause issues with broken references.


  1. Create a new field on the location (cmn_location) called Active (u_active) and make it a true/false field.
  2. Make the locations you want to appear active (true) and those that you don't, leave unchecked.
  3. Create a before/query business rule that automatically filters for the active records only. Use the "user query" business rule as an example (substitute YOURINSTANCE for your instance name in the following URL
    1. https://YOURINSTANCE.service-now.com/nav_to.do?uri=sys_script.do?sys_id=62a7bfaf0a0a0a6500c49682bd82...

View solution in original post

21 REPLIES 21

Here is the query I created; I'm not getting the desired result.   Suggestions?


find_real_file.png


The filter condition simply says "Should the BR run" it doesn't actually do the filtering. In the Advanced tab, your script should contain:



current.addQuery('active', true);



That's the part that does the filtering of the records.



Scripting in Business Rules - ServiceNow Wiki


If it is really needed by many customers, would ServiceNow consider to make the field Active an OOB field and add corresponding business rule?

I have tried what you suggested above and it still isn't working.  

1. I added a new field on the cmn_location called Active (u_active) as true/false

2. Created a new BR for Location Query on the cmn_location table

3. Added your script line from below:  current.addQuery('u_active', true);

4. I set one of my many locations to true to see if only that one returns

But for some reason when I click on the lookup button on the location, it returns all the locations for my incidents.  I would be quite beneficial to have a BR rather than update all references especially since we prompt for location in many of our catalog requests.  Here are my BR screen shots.   So any help would be greatly appreciated, please.

find_real_file.png

find_real_file.png

I removed the filter on the 'when to run' and it worked.  no need for assistance but your information has been extremely helpful!