Skip to content

UX Data broker to fetch system property in UI Builder #1480

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions UX Data Broker Transform/FetchSysProperty/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
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.
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.
Just a note that in the data broker record properties field, please add below json object:
[ { "name": "property_name",
"label": "Property",
"fieldType": "string",
"readOnly": false,
"mandatory": true,
"defaultValue": "",
"description": "System property name" } ]
21 changes: 21 additions & 0 deletions UX Data Broker Transform/FetchSysProperty/sysPropdataBroker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//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.
function transform(input){
//property_name is one of the properties that the UX Transform Data broker needs. It's a field name.
var property_name = input.property_name;
var objProp = {};
if(!property_name){
objProp.errorValue = 'Please provide the property name.';
return objProp;
}
var grSysProp = new GlideRecord('sys_properties');
grSysProp.addQuery('name',input.property_name);
grSysProp.query();
if(grSysProp.next()){
objProp.value = grSysProp.getValue('value');
}
if(!objProp.hasOwnProperty('value')){
objProp.noPropertyFound = `The property ${property_name} was not found.`;
return objProp;
}
return objProp;
}
Loading