Skip to content

Commit 5a253fb

Browse files
UX Data broker to fetch system property in UI Builder (#1480)
* Create sysPropdataBroker.js Once this is saved, it will show up in UI Builder as a Data Resource which can be selected if the user wants to fetch system property table values. * Create readme.md
1 parent 185759c commit 5a253fb

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Once this code snippet is added in a new transform data broker in sys_ux_data_broker_transform table, this will start showing up in UIB data resources.
2+
Once the data resource is added to the page of any experience, the user only needs to input the property_name field and rest will be take care of.
3+
Just a note that in the data broker record properties field, please add below json object:
4+
[ { "name": "property_name",
5+
"label": "Property",
6+
"fieldType": "string",
7+
"readOnly": false,
8+
"mandatory": true,
9+
"defaultValue": "",
10+
"description": "System property name" } ]
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//Once this is saved, it will show up in UI Builder as a Data Resource which can be selected if the user wants to fetch system property table values.
2+
function transform(input){
3+
//property_name is one of the properties that the UX Transform Data broker needs. It's a field name.
4+
var property_name = input.property_name;
5+
var objProp = {};
6+
if(!property_name){
7+
objProp.errorValue = 'Please provide the property name.';
8+
return objProp;
9+
}
10+
var grSysProp = new GlideRecord('sys_properties');
11+
grSysProp.addQuery('name',input.property_name);
12+
grSysProp.query();
13+
if(grSysProp.next()){
14+
objProp.value = grSysProp.getValue('value');
15+
}
16+
if(!objProp.hasOwnProperty('value')){
17+
objProp.noPropertyFound = `The property ${property_name} was not found.`;
18+
return objProp;
19+
}
20+
return objProp;
21+
}

0 commit comments

Comments
 (0)