Skip to content
IT Canvass
Development · Lesson

UI policies & UI actions

Quick answer

UI policies and UI actions are two of the most-used configuration tools on the platform. A UI policy changes how a form behaves, which fields are mandatory, visible or read-only, declaratively, no code required. A UI action adds a button, link or context-menu item that runs logic when clicked.

Key takeaways

  • UI policy: no-code form control
  • UI action: buttons that do things
  • When to use which
  • Try it Yourself

UI policies and UI actions are two of the most-used configuration tools on the platform. A UI policy changes how a form behaves, which fields are mandatory, visible or read-only, declaratively, no code required. A UI action adds a button, link or context-menu item that runs logic when clicked.

UI policy: no-code form control

Define a condition (e.g. Category is Hardware) and the platform enforces the resulting field states automatically, on the client, everywhere the form appears. UI policies run after and can override client scripts, so prefer them for simple show/hide/mandatory.

UI policy vs data policy. A UI policy acts on the form in the browser. A data policy enforces the same rules at the database level, so imports and API writes obey them too. Build a data policy first, then 'convert' it to a UI policy for the on-screen experience.

UI action: buttons that do things

A UI action can run on the client, the server, or both. The Client checkbox plus an onClick function runs browser code; leaving it server-side runs a script with current in scope.

// Server-side UI action: "Escalate" button current.priority = '1'; current.work_notes = 'Escalated via UI action by ' + gs.getUserName(); current.update(); action.setRedirectURL(current);

When to use which

  • UI policy, field must be mandatory/hidden/read-only under a condition.
  • UI action, user needs to trigger an operation (approve, escalate, generate).
  • Client script, you need custom logic on load/change that a UI policy can't express.

Want to learn this properly?

Our live, instructor-led ServiceNow Training covers this hands-on, with real projects and a certification path.

Check your understanding

  1. A UI policy requires...

    • A. No code, it is declarative
    • B. A business rule
    • C. A MID Server
    Show answer

    A. No code, it is declarative

    UI policies configure field states without scripting.

  2. To enforce the same rule for imports and API writes, use a...

    • A. Data policy
    • B. UI policy
    • C. UI action
    Show answer

    A. Data policy

    Data policies enforce at the database level.

  3. A UI action is best for...

    • A. A button that triggers an operation
    • B. Hiding a field on a condition
    • C. Nightly cleanup
    Show answer

    A. A button that triggers an operation

    UI actions give users a control to run logic.

Frequently asked questions

What does the term UI policies & UI actions refer to in ServiceNow?

UI policies and UI actions are two of the most-used configuration tools on the platform. A UI policy changes how a form behaves, which fields are mandatory, visible or read-only, declaratively, no code required. A UI action adds a button, link or context-menu item that runs logic when clicked.

What else is worth knowing about UI policies & UI actions?

Category is Hardware) and the platform enforces the resulting field states automatically, on the client, everywhere the form appears.

What is the practical takeaway on UI policies & UI actions?

UI policies run after and can override client scripts, so prefer them for simple show/hide/mandatory.
CallWhatsAppEnquire