How to Open a Survey in a Dialog Window from a UI Action

HarikaNakhate
Tera Contributor

Hi all,

I’ve created a survey using Survey Designer and added a UI Action on a custom table. The UI Action appears under Related Links, and I want it to open the survey form in a dialog window (modal) within the same tab, instead of redirecting to a new page.

Is creating a UI Page and linking it to the UI Action the right approach for this? Or is there any other recommended method to open the survey in a modal?

Appreciate any suggestions or best practices!

1 ACCEPTED SOLUTION
3 REPLIES 3

SD_Chandan
Kilo Sage

Hi @HarikaNakhate ,

You can refer this thread(similar to your question) of guidance :-
https://www.servicenow.com/community/sysadmin-forum/how-to-send-a-survey-notification-using-ui-actio...

 

Thank you
Chandan

kaushal_snow
Mega Sage

Hi @HarikaNakhate ,

 

You can utilize in this way:

 

var dialog = new GlideDialogWindow('ui_page_name');
dialog.setTitle('Survey');
dialog.setSize(800, 600);
dialog.render();

 


This script will open the UI Page in a modal window with the specified size....

Pass Parameters to the UI Page....

 

If you need to pass parameters (e.g., sys_id of the record) to the UI Page, modify the GlideDialogWindow code as follows:

 

var dialog = new GlideDialogWindow('ui_page_name');
dialog.setTitle('Survey');
dialog.setSize(800, 600);
dialog.setPreference('sys_id', current.sys_id);
dialog.render();

 


In the UI Page, retrieve the parameter using:

 

var sys_id = g_dialog.getPreference('sys_id');

 

 

Check this article: https://servicenowguru.com/system-ui/glidedialogwindow-advanced-popups-ui-pages

 

If you found my response helpful, please mark it as ‘Accept as Solution’ and ‘Helpful’. This helps other community members find the right answer more easily and supports the community...

 

Thanks and Regards,
Kaushal Kumar Jha - ServiceNow Consultant - Lets connect on Linkedin: https://www.linkedin.com/in/kaushalkrjha/

Ankur Bawiskar
Tera Patron
Tera Patron

@HarikaNakhate 

Is this a valid business requirement?

Surveys are usually taken by end user after their ticket/case is closed and they won't come to native view.

If you still want to proceed then check these steps

1) for your current record check the Assessment Instance table and see which Survey is pending

2) form the URL and grab it

3) then open that URL in new tab using client side UI action

If my response helped please mark it correct and close the thread so that it benefits future readers.

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