Default values for UI Builder pages

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2023 05:03 PM
When it comes to using Required or Optional parameters for pages in UI Builder, is there a way to set a default value?
Use case:
1. My page requires a SysID
2. I either want to pass it an existing SysID or have it default to -1 (new record)
3. I need to be able to open this page using the side navigation menu (which does not allow parameter passing, so I need to be able to have a default value).
If I use recquired parameters and exclude -1 then I get page not found.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2023 01:59 AM
Hi,
Setting a default value for page parameters is not possible. Though you can pass in the values from side navigation menu. Below is an example. Let me know if you need help to create side navigation menu item.
{
"label": {
"translatable": true,
"message": "Create Reord"
},
"routeInfo": {
"route": "your_route",
"fields": { //This is how you can pass values for required parameters
"sysId": "-1"
}
}
}
ServiceNow Community Rising Star 2022/2023