UI Action is not working on form

Pravallika Rach
Tera Contributor

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();
}

 

 

6 REPLIES 6

SanjivMeher
Kilo Patron
Kilo Patron

Is change_table a table? Do you need change_request there instead.

 

SanjivMeher_0-1701821898009.png

 


Please mark this response as correct or helpful if it assisted you with your question.

Change table is a table name its a correct table name

Ok.. I am going to make few improvements to your script although I dont understand the intent here.

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");//change table
    inc.addQuery("name", "CONTAINS", a);
    inc.query();
    if (inc.next()) {
        b = inc.getValue("assessment_instance");
    var ass = new GlideRecord("assessment");
    ass.addQuery("number", b);
    ass.query();
    while (ass.next()) {
        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();
}

  


Please mark this response as correct or helpful if it assisted you with your question.

I have tried with above code but it's not working