UI Action is not working on form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2023 03:15 PM - edited 12-05-2023 03:31 PM
UI Action is not working on the task table where we are doing gliderecord on the change table as the reference field(assessment_instance) and gliderecord on the assessment table as we need to get the data.
When I remove the glide record lines then we click on UI Action it is working and getting popup but data is not displaying
Please guide me to resolve the issue.
Thanks in Advance.
UI Action :
function showResponse() {
var id = g_form.getUniqueValue();
var type = g_form.getValue('metric_type');
var a = g_form.getValue('number');
var inc = new GlideRecord("change_table");//change table
inc.addQuery("name", "CONTAINS", a);
inc.query();
while (inc.next()) {
var b = inc.getValue("assessment_instance");
}
var ass = new GlideRecord("assessment");
ass.addQuery("number", b);
ass.query();
while (ass.next()) {
var c = ass.getValue("sys_id");
}
var url = 'assessment_take.do?sysparm_assessable_sysid=' + b + '&sysparm_assessable_type=' + type + '&sysparm_reader_view=true';
var d = new GlideOverlay({
title: getMessage("User's Response"),
iframe: url,
width: '80%',
height: '100%',
onAfterLoad: function() {
var iframe = d.getIFrameElement();
setTimeout(function() {
iframe.height = parseInt(iframe.height) + 1;
}, 0);
}
});
d.render();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2023 08:28 PM
HI @Pravallika Rach ,
I trust you are doing great.
Here is a revised version of your script with some of these suggestions:
function showResponse() {
var id = g_form.getUniqueValue();
var type = g_form.getValue('metric_type');
var a = g_form.getValue('number');
var b = '';
var c = '';
var inc = new GlideRecord("change_table");
inc.addQuery("name", "CONTAINS", a);
inc.query();
if (inc.next()) {
b = inc.getValue("assessment_instance");
} else {
console.log("No matching records in change_table.");
return;
}
var ass = new GlideRecord("assessment");
ass.addQuery("number", b);
ass.query();
if (ass.next()) {
c = ass.getValue("sys_id");
} else {
console.log("No matching records in assessment.");
return;
}
var url = 'assessment_take.do?sysparm_assessable_sysid=' + b + '&sysparm_assessable_type=' + type + '&sysparm_reader_view=true';
var d = new GlideOverlay({
title: getMessage("User's Response"),
iframe: url,
width: '80%',
height: '100%',
onAfterLoad: function() {
var iframe = d.getIFrameElement();
setTimeout(function() {
iframe.height = parseInt(iframe.height) + 1;
}, 0);
}
});
d.render();
}
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2023 08:51 PM
Nope, I have tried the code but bad luck its not working