Adding multiple reference columns to a reference field on a UI Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2024 02:45 PM - edited 05-10-2024 02:47 PM
How can I add multiple reference columns to a reference field on a UI Page?
For example, I'd like all user's names to populate with their associated company/id
I've tried adding attributes to the sys_user table, and that works wonderfully for typical user reference fields, but I'm having trouble when it's a UI Page.
Any help would be appreciated!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2024 06:56 PM
Hi @jr1287,
Have you tried adding columns attribute?
e.g.
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2024 03:12 PM
Hi @jr1287 ,
If you have used g_ui_reference jelly tag please send the code of entire page so that i could help you ?
Please mark this comment as Correct Answer/Helpful if it helped you.
Regards,
Swathi Sarang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2024 05:19 AM
I found a solution to the issue without using g.ui_reference, for anyone who needs it in the future.
transport: function (params) {
var retrieveURL = 'api/now/table/' + employeeTableName + '?sysparm_query=' + employeeDisplayField + 'CONTAINS' + params.data.q + '&sysparm_fields=' + employeeDisplayField + ',' + employeeIdField + ',' + employeeNumberField + ',' + employeeCompanyField;
return $http.get(retrieveURL).then(function (response) {
params.success.apply(this, [response]);
});
},
results: function (response, page) {
var pageSize = 20;
var responseResult = response.data.result;
var total = responseResult.length;
var results = [];
// Add items to result set
for (var i = 0; i < responseResult.length; i++) {
var item = responseResult[i];
results.push({
id: item[employeeIdField],
text: item[employeeDisplayField] + ' / ' + item[employeeNumberField] + ' / ' + item[employeeCompanyField],
employee_number: item[employeeNumberField],
employee_company: item[employeeCompanyField],
});
}