- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2023 10:16 AM
Hi All,
I have requirement where I need to create a schedule Job which runs every 30mins and it should execute a "Test connection" UI action in it. As per the UI action's result a notification should send to certain group.
UI Action: (Onclick : testAccountConnection(); )
var title = getMessage('Connection Test');
function testAccountConnection() {
var gm = new GlideModal('email_connection_test', false /*read-only*/ );
gm.setTitle(title);
gm.setWidth(500);
gm.render();
}
I have tried to copy paste the UI action's script in Script Include. And updated schedule job with "new emailAccountTestConnection().emailTestConnection();"
In Script Include :
var emailAccountTestConnection = Class.create();
emailAccountTestConnection.prototype = Object.extendsObject(AbstractAjaxProcessor, {
emailTestConnection: function() {
var title = getMessage('Connection Test');
var gm = new GlideModal('email_connection_test', false /*read-only*/ );
gm.setTitle(title);
gm.setWidth(500);
gm.render();
return gm;
},
type: 'emailAccountTestConnection'
});
But I'm facing com.glide.script.RhinoEcmaError: "getMessage" is not defined or com.glide.script.RhinoEcmaError: "GlideModal" is not defined.
Could you please advice any preferable steps to complete this task ? Its quite urgent now.
Thank you
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2023 10:27 AM
You are not going to be able to run a client side UI action via a scheduled job. Especially one that opens a dialog. You are going to have to understand how the UI Page/UI Macro "email_connection_test" works and do the same thing that does in your scheduled job.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2023 06:25 AM
Hi @Ratnakar7 , Thank you !! I will definitely try this steps once I found the UI page ( "email_connection_test" ) and the table details its using.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2023 07:44 AM
Several other ways you can search for this.
1 - Install the SN Utils plugin in Chrome and use its code search option.
2 - Turn on text indexing for the sys_metadata table and then do a search for email_connection_test.
I did the second one and the UI page/Macro does not exist in a way that will allow you to see the code. You are going to have to log a support case to see if ServiceNow will help you with understanding how to do what you need to do.