sarah_bioni
ServiceNow Employee
ServiceNow Employee

When working with Record Pages in UI Builder, there are cases where you need to set default values for fields in a form. This guide outlines the correct steps to configure this behavior in the Form Controller.

 

🎯 Steps to Set a Default Value in a Form Field

1️⃣ Open the Record Page in UI Builder

 

sarah_bioni_0-1748873119244.png

 

2️⃣ Select the Form Component

  • In the UI Builder canvas, click on the Form component.

sarah_bioni_1-1748873173393.png

  • In the right-hand panel, locate the Form Controller section.

  • Click the gear icon (⚙️) next to the Form Controller.

sarah_bioni_2-1748873184868.png

 

3️⃣ Add or Edit the Event

  • In the Form Controller configuration, go to the Events tab.

  • Look for the event:

     
    [Record Page] Record data fetch succeeded
     
    sarah_bioni_4-1748873237816.png

     

  • If it doesn’t exist, create it.

4️⃣ Configure the [Field] Set Value Action

  • Inside the event, add a new action:

    [Field] Set Value
    sarah_bioni_5-1748873374369.png

     

     

  • Select the field you want to set.
  • Provide the Value and Display Value.

5️⃣ Apply the Changes

  • Click Apply to save the configuration.

Comments
Marskh11
Tera Guru

Does this work for new records as well using viewport/subpage? I have a button that opens a modal that is just a subpage for a new record and I need to default values based on the parent page and I can't seem to get that to set right. 

sarah_bioni
ServiceNow Employee
ServiceNow Employee

Hi @Marskh11 ,

Have you tried pulling the data via record watcher? Normally if you are dealing with something standard it is in data resources.

Screenshot 2025-06-12 at 11.00.26.png

Regards,

Sarah Bioni

n4t411
Giga Explorer

How to set scripted value like: javascript:gs.now() in this context?

sarah_bioni
ServiceNow Employee
ServiceNow Employee

Hi @n4t411,

 

You need to add a new data resource called Now DateTime

sarah_bioni_0-1751895300801.png

Regards,

Sarah Bioni

Version history
Last update:
‎06-02-2025 07:13 AM
Updated by:
Contributors