Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

sarah_bioni
ServiceNow Employee
ServiceNow Employee

In this article, we’ll demonstrate how to create a Data Broker Server Script that retrieves the value of a specific system property by its name. This is particularly useful when building Workspace experiences that require dynamic property values through Data Resources.

 

Step 1: Define the Data Broker Properties

Add a property to capture the name of the system property you want to retrieve:

[
{
"name": "property_name",
"label": "Name of property",
"description": "Name of the required property",
"readOnly": false,
"fieldType": "string",
"mandatory": true,
"defaultValue": ""
}
]
 

This ensures the Data Broker accepts the property name as input.


Step 2: Implement the Server Script

Use the following script in your Data Broker:

function transform(input) {
var grProperties = new GlideRecord('sys_properties');
grProperties.addQuery('name', input.property_name);
grProperties.query();
if (grProperties.next()) {
return grProperties.getDisplayValue('value');
} else {
return "Property name was not found";
}
}
 

Key Points:

  • The script queries the sys_properties table.
  • If the property exists, it returns its display value.
  • If not found, it returns a friendly message.

sarah_bioni_1-1763730153408.png

 


Step 3: Configure in UI Builder

Once the Data Broker is created:

  1. Navigate to UI Builder.
  2. Add a Data Resource using your new Data Broker.
  3. Pass the property name dynamically or statically.
  4. Bind the returned value to your component.

sarah_bioni_0-1763730142886.png

 

Version history
Last update:
30m ago
Updated by:
Contributors