How can I show an assessment on a form by clicking UI action?

cicgordy
Tera Guru

Hi all,

I created an assessment and I would like it to show on a form, by clicking a UI action(link) and then for users to submit it. How can I achieve that?? Anyone can help with script?

 

Thanks

4 REPLIES 4

Samaksh Wani
Giga Sage
Giga Sage

Create a UI Action Button on the Form or Table where you need.

 

Write this UI Action Script

 

 

function onClick() {
    var ga = new GlideAjax('global.customSurveyUtil');
    ga.addParam('sysparm_name', 'createSurvey');
    ga.addParam('sysparm_tablename', g_form.getTableName());
    ga.addParam('sysparm_sysid', g_form.getUniqueValue());
    ga.getXML(ajaxResponse);
    function ajaxResponse(serverResponse) {
        var answer = serverResponse.responseXML.documentElement.getAttribute("answer");
        //window.open(answer, "Feedback", "width=600,height=500,toolbar=yes,scrollbars=yes");
        g_navigation.openPopup(answer);
    }

}

Hi @Samaksh Wani , where in this code above you provided, should I add the name of the survey I have already created and also the table name where is stored?

Thanks

Samaksh Wani
Giga Sage
Giga Sage

Name of the Survey you need to add

@Samaksh Wani 

Do you know where exactly I will need to add this in your code? Thanks