Issue with UI Action on Workspace

shyam34
Tera Contributor

Hello All , 

I have an UI Action button which Generates Session Key from beyond this Works well on UI but not on SOW Workspace , I see in the script they used glide dialogue window but seems it is deprecated 

I tired with Glide Model but it is not working can you please check and amend the changes

 

function onClick(g_form) {
    generateERSServerSessionKey();

    function generateERSServerSessionKey() {
        var ga = new GlideAjax('x_bmgr_support_ent.BomgarRemoteSupport');
        ga.addParam('sysparm_name', 'generateSessionKeyServerSide');
        ga.addParam('sysparm_record_id', g_form.getUniqueValue());
        ga.addParam('sysparm_table_type', 'task');
        ga.getXML(handleERSServerSessionKeyCallback);
    }

    function handleERSServerSessionKeyCallback(response) {
        var answerString = response.responseXML.documentElement.getAttribute("answer");

        if (answerString === null) {
            alert('Something went wrong while attempting to generate a session key.');
            return;
        } else if (answerString.startsWith('ERROR')) {
            var error = answerString.substring(6);
            alert('An error occurred: ' + error);
            return;
        }

        var sessionKeyJson = JSON.parse(answerString);
        openLanguagePopup(sessionKeyJson);
    }

    function openLanguagePopup(sessionKeyJson) {
        var dialog = new GlideModal('bomgar_session_key');
        dialog.setTitle("Remote Support Session Key");
        dialog.setSize(620, 200);
        dialog.setPreference("session_link", sessionKeyJson.keyUrl);
        dialog.setPreference("session_key", sessionKeyJson.shortKey);
        dialog.setPreference("record_id", g_form.getUniqueValue());
        dialog.setPreference("subject", sessionKeyJson.mailSubject);
        dialog.setPreference("body", sessionKeyJson.mailBody);
        dialog.render();
    }
}
 
6 REPLIES 6

@shyam34 

can you post a new question as this is an old thread and tag me there?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader