We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

Unable to create UI Action button in workspace.

dusmantanayak
Tera 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
2 ACCEPTED SOLUTIONS

Ankur Bawiskar
Tera Patron

@dusmantanayak 

Ensure "Format For Configurable Workspace" checkbox is True

Remove line 3

AnkurBawiskar_0-1771218581133.png

 

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

View solution in original post

Hello @dusmantanayak ,

 

I hope you are doing well. Does my response helps you ?

 

If my response helps you then mark it as helpful and accept as solution.

You can accept multiple solutions 😀 .

 

Regards,

Aditya,

Technical Consultant

View solution in original post

6 REPLIES 6

Tanushree Maiti
Tera Patron

Ensure in your UI button configuration  "Format for Configurable Workspace" is checked. Then try.

 

TanushreeMaiti_0-1771163827264.png

 

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti

Aditya_hublikar
Giga Sage

Hello @dusmantanayak ,

 

When you check Workspace Form Button  then Format for Configurable Workspace get automatically checked OOTB but in your screenshot it it unchecked . Please ensure that it is checked () . One another thing 1st comment is  uncomment in your  3rd screenshot please comment that .


 

Aditya_hublikar_0-1771165120051.png

 

Aditya_hublikar_1-1771165334698.png

Aditya_hublikar_3-1771165397494.png

 

 

If this helps you then mark it as helpful and accept as solution.

Regards,

Aditya,

Technical Consultant

 

 

Hello @dusmantanayak ,

 

 I hope you are doing well . Does my response helps you ?

 

If my response helps you then mark it as helpful and accept as solution

Regards,

Aditya ,

Technical Consultant

Hello @dusmantanayak ,

 

I hope you are doing well. Does my response helps you ?

 

If my response helps you then mark it as helpful and accept as solution.

You can accept multiple solutions 😀 .

 

Regards,

Aditya,

Technical Consultant