Courseiva
User Interface DevelopmentmediumMultiple ChoiceObjective-mapped

Using UI Policy to Display a Conditional Message Without Scripting

A developer is designing a custom form in the standard UI (UI16) and needs to add a message that displays only when the 'state' field is 'Closed'. Which feature should be used to achieve this without custom scripting?

Quick Answer

UI Policies are the right tool here because they are ServiceNow's declarative, condition-driven way of controlling form behavior on the client side, and displaying a message under a specific condition is exactly the kind of behavior they are designed to handle without requiring anyone to write a script. When you configure a UI Policy with the condition state=Closed, the platform evaluates that condition on the client as the form loads or as the field changes, and it can then trigger an informational, warning, or error message the moment that condition is true, all through configuration rather than code. This makes UI Policies the appropriate choice specifically because the requirement explicitly rules out custom scripting; if scripting were allowed or preferred, a client script could achieve something similar, but UI Policies exist precisely to give administrators and developers this kind of conditional, no-code control over form elements like field visibility, mandatory status, read-only state, and messages. The general pattern to remember is that whenever a requirement describes changing something about how a form behaves or looks based on a field's value, and specifically calls for a no-code or low-code solution, a UI Policy should be your first consideration, since it is the platform's purpose-built declarative mechanism for exactly that kind of conditional form logic.

⚠ Common exam trap

Test-takers frequently confuse UI Policies with Client Scripts, thinking that any client-side behavior requires scripting, when in fact UI Policies provide a no-code alternative for simple conditional actions like showing messages.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Create a UI Policy that adds a message when the condition state=Closed is true.

UI Policies are the correct declarative feature in UI16 to show a message based on a field value without custom scripting. They run on the client side and can display informational, warning, or error messages when a specified condition (like state=Closed) is met, making option A the appropriate choice.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Create a UI Policy that adds a message when the condition state=Closed is true.

    Why this is correct

    UI Policies can conditionally display messages without scripting.

  • Create a form section and set its condition via the 'Conditional' property.

    Why it's wrong here

    Form sections cannot be conditionally displayed based on field values.

  • Write a Client Script that shows a message when state changes to Closed.

    Why it's wrong here

    Requires scripting; not the low-code approach.

  • Use a UI Macro with a condition that checks the state field.

    Why it's wrong here

    UI Macros require scripting and are not low-code.

About these practice questions

This SNOW-CAD question is part of Courseiva's 481-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Same concept, more angles

1 more way this is tested on SNOW-CAD

These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.

Variation 1. A developer needs to display a warning message to the user when the 'priority' field is changed to '1 - Critical'. Which TWO client-side implementations can achieve this?

easy
  • A.Business Rule with 'when to run' set to 'before' and script to call g_scratchpad.message
  • B.UI Policy with condition: 'Priority changes' and action script to call g_form.showFieldMsg()
  • C.onLoad client script that checks the current value of priority and shows a message
  • D.Data Policy with condition on priority field and message set
  • E.onChange client script with a condition to check newValue and call g_form.showFieldMsg()

Why B: A UI Policy with the condition 'Priority changes' triggers an action script when the priority field is modified, allowing the use of `g_form.showFieldMsg()` to display an inline warning message on the field. Option E is correct because an onChange client script fires when the 'priority' field changes, and within it you can check `newValue` against '1 - Critical' and call `g_form.showFieldMsg()` to show the warning. Both are client-side implementations that respond to field changes without a server round-trip.

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This SNOW-CAD practice question is part of Courseiva's free ServiceNow certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the SNOW-CAD exam.