UI Page - Show the records of a table as a drop down
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi,
I want to display a pop-up window from a UI Action using a UI Page to show a list of attachments related to the corresponding record in a drop-down. Using ui_reference, I can display them as a reference icon. Is there any UI Macro available to display these records in a drop-down? How can I achieve this ?
Thanks!
Ram
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
There are multiple ways to do it, I leave one example below.
UI page:
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:evaluate var="jvar_recordtId" expression="RP.getWindowProperties().get('sysparm_record') || RP.getParameterValue('sysparm_record')" />
<g:evaluate var="jvar_recordtTable" expression="RP.getWindowProperties().get('sysparm_table') || RP.getParameterValue('sysparm_table')" />
<g:evaluate object="true" jelly="true">
var id = jelly.jvar_recordtId;
var table = jelly.jvar_recordtTable;
var grAtt = new GlideRecord('sys_attachment');
grAtt.addQuery('table_name', table);
grAtt.addQuery('table_sys_id', id);
grAtt.query();
grAtt;
</g:evaluate>
<select>
<j:while test="${grAtt.next()}">
<option value="${grAtt.name}">${grAtt.file_name}</option>
</j:while>
</select>
</j:jelly>
Then on the UI action (on this example I used an action in the workspace) :
function openModal() {
var recordId = g_form.getUniqueValue();
var table = g_form.getTableName();
var url = "my_test_ui_page.do?sysparm_record=" + recordId + '&sysparm_table=' + table;
g_modal.showFrame({
title: "Available Attachments",
url: url,
size: 'md',
});
}
Hope it helps.
