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

how to add message to the screen using g_modal

Alon Grod
Tera Expert

Hi,

How can I add message to the screen using g_modal but not g_modal.alert.

11 REPLIES 11

Ankur Bawiskar
Tera Patron

@Alon Grod 

yes g_modal should work

something like this

g_modal - Client 

How to use UI Actions in Workspaces 

        g_modal.alert('My response');

💡 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

Ankur Bawiskar
Tera Patron

@Alon Grod 

this worked for me

AnkurBawiskar_0-1767510842886.png

Output

AnkurBawiskar_1-1767510863132.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

@Ankur Bawiskar i dont want that 'Alert' will apear, i want just the box

@Alon Grod 

Yes you can , you can see below example:

 

Simple use-case: Script to group list by caller id and set row to 10 showing usage of g_modal

 

Mohammed8_0-1767522482656.png

 

Workspace Testing:

 

Clicking the dialog box

 

Mohammed8_1-1767522847621.png

 

After clicking Ok

 

Mohammed8_2-1767522916311.png

 

Script for reference:

 

function onClick() {

  // g_list IS GlideList

 

  g_modal.confirm(

    "Confirmation",

    "Are you sure you want to sort the list by caller_id?",

    function (ok) {

      if (!ok)

        return;

   

    g_list.setRowsPerPage(10);

    g_list.setGroupBy("caller_id");

    g_list.refresh(1);

     

    }

  );

}

 

If you find this answer helpful, please mark the it as helpful/solution accepted:

 

Thanks and Regards,

Mohammed Zakir