UI Builder client handler how pass url
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi team,
I want pass url in UI Builder client handler.
when hardcoded its redirecting but there multiple upper instance UAT, Prod , it is not proper to hardcode. please suggest a solution call url of current instace to UI Builder client handler
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
UI Builder client handler
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
@armanoj ,
If you are trying to open the page that is already present in that workspace use the OOB Open Page or URL event handler, here ServiceNow automatically prepends whatever active instance URL (Dev, UAT, or Prod) the user is currently on.
If my response helped, mark it as helpful and accept the solution.
Thanks,
Dinesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @armanoj
For your requirement, you need to use a server-side script in UI Builder to retrieve the current instance ID. However, this cannot be done directly in UI Builder. You need to create a Data Broker Server Script to fetch the current instance ID.
Steps to Configure the Data Broker Server Script
- In the Application Navigator, search for Now Experience Framework and select Transforms.
- Click New and create a new Transform/Data Broker Server Script with a name of your choice.
- In the Properties field, provide an array of inputs if required. For this requirement, inputs are not required, so you can leave it empty.
- In the Script section, add the following code:
function transform() {
return {
"instance_URL": gs.getProperty("instance_name")
};
}- In the Output Schema section, add the following:
{
"type": "object",
"properties": {
"instance_URL": {
"type": "string"
}
}
}- Save the record and copy the sys_id of the Data Broker Server Script.
Configure the ACL
- Navigate to Access Controls (ACLs) and create a new ACL.
- Set the Type to:
ux_data_broker- Set the Operation to:
execute- Next to the Name field, click the small blue icon. In the placeholder, enter the sys_id of the Data Broker Server Script that you copied earlier.
Important: Remove the * that appears before the sys_id in the placeholder. The Name should contain only the Data Broker's sys_id.
- In the Requires role section, select the appropriate role for the users who need to execute the Data Broker, and save the ACL.
Use the Data Broker in UI Builder
- In UI Builder, create a Client State Parameter as required.
- In the Data Source section, click (+), search for the Data Broker Server Script you created, and add it as a data source.
- Bind the required value from the Data Broker to the Client State Parameter you created.
The Data Broker will return only the instance ID, for example:
dev123456If you need the complete instance URL, you can construct it by adding the required domain:
https://dev123456.service-now.comTherefore, the final URL can be constructed using the instance ID returned by the Data Broker.
please refer below video
https://youtu.be/QrTc8PTOHmc?si=liyumu-eeKEfL7xs
If my response helped, mark it as helpful and accept the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I created the data broker unable to add in ui builder . new data broker there add button not visible.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @armanoj ,
Do you mean add button not visible in the ui builder for adding the created data broker?
You can directly add the created data broker in the ui builder by going to left side Data source click + sign
Then type your Data broker name created.
If my response helped, mark it as helpful and accept the solution.
