- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2023 08:01 AM
I am trying to force a custom view on everyone (for testing) in our DEV instance on the cmn_schedule_span table by copying the logic in the OOB business rule "incident functions".
This business rule is NOT setting the view and I double checked that it is correctly named. Am I missing something?
Table: Global
Active: True
Advanced: True
When to Run: No conditions
Script:
function cmn_schedule_spanGetViewName() {
answer = "crc";
}
function cmn_schedule_span_listGetViewName() {
cmn_schedule_spanGetViewName();
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2023 08:48 AM
Update to anyone else that has this issue in the future.
The business rule or view rule won't take place if the user manually selected a view previously. That's the issue I was running into is the view rule was being ignored because my test user's view wasn't set to default on the table I was trying to force the rule.
As soon I set the view back to manual, both the business rule and UI rule were working fine. I removed the custom BR and kept the UI rule.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2023 08:19 AM
Hi there,
What's the reason for doing this with a Business Rule? Why not View Rules?
System UI > View Rules
Kind regards,
Mark
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2023 08:21 AM - edited 06-17-2023 08:29 AM
Because that's not working for me either. I am an admin but since I am not applying any role restrictions, I am expecting it to force my view when I open any cmn_schedule_span record but it's defaulting back to whatever view I manually selected last time.
The view itself is below. Just to show that it really is named crc.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2023 08:48 AM
Update to anyone else that has this issue in the future.
The business rule or view rule won't take place if the user manually selected a view previously. That's the issue I was running into is the view rule was being ignored because my test user's view wasn't set to default on the table I was trying to force the rule.
As soon I set the view back to manual, both the business rule and UI rule were working fine. I removed the custom BR and kept the UI rule.