Skip to tutorial content
Rate module 4.0/5 (1)

View Rules

3 min read
On this page

In this lesson, you will learn:

  • What a view rule is
  • The main fields on a view rule
  • How to create a view rule that picks a view automatically

1 Pick the view for me

In Lesson 15.2, users picked a view by hand. But what if you want ServiceNow to pick the right view automatically? For example: always show the “Hardware” view when an incident’s category is Hardware.

That’s a view rule. πŸ€–

Key term: View rule

A rule that tells ServiceNow which view to show on a form, based on conditions. Stored in the sys_ui_view_rule table.

2 The parts of a view rule

A view rule record. 1: Name, Hardware incidents. 2: Table, Incident. 3: Conditions, Category is Hardware. 4: Device type, Browser. 5: View, Hardware. 6: Active is checked. Result: when anyone opens an incident with category Hardware in a browser, the Hardware view is shown automatically.
Figure 1. If the conditions match, ServiceNow shows the chosen view.
Field What it does
Name A clear name for the rule
Table Which table’s forms it applies to
Conditions When the rule should apply, like Category is Hardware
Device type Browser, mobile, or tablet
View The view to show
Active Turns the rule on or off

πŸ“ Note: There’s also an Advanced option for writing a script instead of conditions. That’s for developers, and ServiceNow suggests using conditions when you can.

3 Create a view rule

  1. Click All and go to System UI > View Rules.
  2. Click New.
  3. Fill in the Name, Table, Conditions, Device type, and View.
  4. Make sure Active is checked, then click Submit.
  5. Open a record that matches. The right view shows by itself. βœ…

⚠️ Heads up: A view rule forces the view. Users may not be able to switch to another view for those records. Make sure that’s what you really want.

⭐ Remember: Users pick views by hand. View rules pick views automatically.

4 Let’s try it: a view for P1s

  1. Make sure you have the SNWR Manager view from Lesson 15.2.
  2. Go to System UI > View Rules and click New.
  3. Name: SNWR P1 manager view. Table: Incident. Conditions: Priority is 1 – Critical. View: SNWR Manager. Submit.
  4. Open a Priority 1 incident. Which view shows?
  5. Open a Priority 3 incident. Which view shows now?
  6. Set the rule to inactive when you’re done.

5 Quick recap

  • A view rule picks a view automatically
  • Key fields: Table, Conditions, Device type, View, Active
  • Create them in System UI > View Rules
  • View rules force the view, so use them carefully

6 Check yourself

Think of your answer first. Then tap to check.

1 What does a view rule do? Show answer

It picks which view to show on a form automatically, based on conditions.

2 Where do you create view rules? Show answer

System UI > View Rules.

3 Which field sets whether the rule applies to phones or browsers? Show answer

Device type.

Nice work! You finished this lesson. πŸŽ‰

Was this lesson helpful?

Have a question or doubt?

Ask here and get help from instructors and fellow learners.

0 / 300

Only logged-in learners can post.