Business rule isn't setting the form view

e_wilber
Tera Guru

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();
}

1 ACCEPTED SOLUTION

e_wilber
Tera Guru

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.

View solution in original post

3 REPLIES 3

Mark Roethof
Tera Patron
Tera Patron

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

LinkedIn

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.

 

e_wilber_0-1687015232775.png

 

The view itself is below. Just to show that it really is named crc.

 

e_wilber_0-1687015739687.png

 

 

e_wilber
Tera Guru

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.