Unable to create UI Action button in workspace.

dusmantanayak
Giga Contributor

Hi,

 

I have created one UI Action button on incident form but unable to populate the button in service operation workspace. Please help me with the issuue.

Script:

function sendIncidentTolenovo() {
    if (g_form.getValue('work_notes') == '') {
        var workNotes = g_form.getValue("work_notes");
        var affectedUser = g_form.getValue("u_affected_user"); // Get the caller
        var gm = new GlideModal("x_telu6_th_lenovo_modal_popup_for_work_notes");
        gm.setTitle("Incident Details");
        gm.setPreference("work_notes", workNotes);
        gm.setPreference("u_affected_user", affectedUser); // Pass the caller to the UI Page
        gm.setSize(600, 400);
        gm.render();
        return false;
    }
    //!current.isNewRecord() && current.active == true && current.correlation_id.toString().indexOf('Lenovo') == -1 && new x_telu6_th_lenovo.THLenovoUtils().isUserInAllowedGroups()
}
 
Workspace script:
 
function onClick(g_form) {

    1. Get values from the Workspace form
    var workNotes = g_form.getValue("work_notes");
    var caller = g_form.getValue("caller_id");

    // 2. Define your UI Page name
    var uiPageName = "x_telu6_th_lenovo_modal_popup_for_work_notes";

    // 3. Open the Modal in Workspace
    // Note: We pass parameters via the URL query string for Workspace frames
    g_modal.showFrame({
        title: "Incident Details",
        url: uiPageName + ".do?sysparm_caller_id=" + caller + "&sysparm_work_notes=" + encodeURIComponent(workNotes),
        size: 'lg',
        height: 500
    });
    var caller = g_form.getValue("caller_id");
    var workNotes = g_form.getValue("work_notes");
    var uiPage = "x_telu6_th_lenovo_modal_popup_for_work_notes";

    // Pass sysparm_workspace=true so the UI Page knows its environment
    var url = uiPage + ".do?sysparm_workspace=true&sysparm_caller_id=" + caller + "&sysparm_work_notes=" + encodeURIComponent(workNotes);

    g_modal.showFrame({
        title: "Incident Details",
        url: url,
        size: 'lg',
        height: 500
    });
}
 
Regards,
Dusmanta
0 REPLIES 0