UI page pop up show list view
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
8 hours ago
Hi ALL
I am trying to create one ui page which will pop up once the user select the configuration item value in catalog variable the ui page will pop-up and shows all incident which is having those have selected configuration item I am using Iframe to get this. But what is happening the sys_id is some how not going to the ui page and it is not rendering the result I want.
BELOW IS MY CLIENT SCRIPT AND UI PAGE SCRIPT
UI PAGE SCRIPT--
<?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="ci_sys_id" expression="RP.getWindowProperties().get('ci_sys_id')" />
<body>
<script>
// Alert to confirm the CI sys_id is received
alert("CI sys_id received: ${ci_sys_id}");
</script>
<!-- Debug message on the page -->
<j:if test="${ci_sys_id == null}">
<div style="color: red; font-weight: bold; padding: 10px;">CI Sys ID is NULL!</div>
</j:if>
<j:if test="${ci_sys_id != null}">
<div style="color: green; font-weight: bold; padding: 10px;">CI Sys ID: ${ci_sys_id}</div>
</j:if>
<g:ui_form>
<div style="height:600px; padding: 10px;">
<iframe
id="incident_list_frame"
src="incident_list.do?sysparm_query=cmdb_ci=${ci_sys_id}&sysparm_view=Default&sysparm_clear_stack=true"
width="100%" height="100%" frameborder="0"
sandbox="allow-scripts allow-forms allow-same-origin allow-popups">
</iframe>
</div>
<div style="padding: 10px; text-align: center;">
<button onclick="returnQuery()" class="btn btn-primary">Get Query</button>
<button onclick="cancelDialog()" class="btn btn-default">Cancel</button>
</div>
</g:ui_form>
</body>
<script>
// Function to return the query to the parent form
function returnQuery() {
var dialog = GlideDialogWindow.get();
var frame = document.getElementById('incident_list_frame');
var frameUrl = frame.contentWindow.location.href;
var queryParam = 'sysparm_query=';
var queryString = '';
if (frameUrl.indexOf(queryParam) !== -1) {
queryString = frameUrl.substring(frameUrl.indexOf(queryParam) + queryParam.length);
queryString = decodeURIComponent(queryString);
}
var parentGForm = dialog.getParentGForm();
if (parentGForm) {
parentGForm.setValue('u_filter_variable', queryString);
}
dialog.destroy();
}
// Function to close the dialog
function cancelDialog() {
GlideDialogWindow.get().destroy();
}
</script>
</j:jelly>
On change client script--
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var dialog = new GlideDialogWindow('incident_list_ui_page');
dialog.setTitle('Incident List');
dialog.setPreference('ci_sys_id', newValue); // pass CI sys_id
dialog.render();
} any suggetions on this
0 REPLIES 0