- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-13-2023 06:07 AM
Hi
I am trying to create a UI action that does 2 things
- Pop up a Client email
- Update a field on the ticket with date & Time
I seem to be able to do both seperatly but not togeother,. hers is my code
To update the incident:
gs.eventQueue('leaver.email', current);
current.u_email_sent_to_sme = gs.nowDateTime();
action.setRedirectURL(current);
current.update();
To call the Email Client Template:
function showEmail1(){
emailClientOpenPop('request', false, null, null, '1537a78e1b4fb550cbb7dce7b04bcb06');
}
Obviously to call the template I need to select Client on the UI Action & add the function to 'Onclick' however when I do this the part that updates the ticket does not work. If I add the ticket update to the function or a separate function this does not work. Both coded separately work OK.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-13-2023 06:26 AM
You need to use gsftSubmit() to make both calls.
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB1005843
https://www.youtube.com/watch?v=yyVnpbidwmE
Thanks
Anil Lande

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2023 04:37 AM
Hi,
Please update your script like below:
function showEmail1() {
emailClientOpenPop('request', false, null, null, '1537a78e1b4fb550cbb7dce7b04bcb06');
gsftSubmit(null, g_form.getFormElement(), "update_request");
}
if (typeof window == 'undefined')
serverCall();
function serverCall() {
gs.eventQueue('leaver.email', current);
current.u_email_sent_to_sme = gs.nowDateTime();
current.update();
action.setRedirectURL(current);
}
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-13-2023 07:24 AM
Thanks
This now Works

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2023 04:37 AM
Hi,
Please update your script like below:
function showEmail1() {
emailClientOpenPop('request', false, null, null, '1537a78e1b4fb550cbb7dce7b04bcb06');
gsftSubmit(null, g_form.getFormElement(), "update_request");
}
if (typeof window == 'undefined')
serverCall();
function serverCall() {
gs.eventQueue('leaver.email', current);
current.u_email_sent_to_sme = gs.nowDateTime();
current.update();
action.setRedirectURL(current);
}
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2023 04:45 AM
Excellent
Thanks for this, it works. Thanks for all your help
Jason
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-13-2023 10:04 AM
Anil
Whilst I thought I had it fixed, it works as expected in dev but when copied to production it does not work.
In fact when the UI Action is active the request behaviour is unusual, I can no longer right click on the form to configure anything
Right click on the form now brings up this
Rather than this
Any ideas what may be causing that
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-13-2023 06:36 AM
do like this
function showEmail1(){
// your GlideAjax call here to update the record
emailClientOpenPop('request', false, null, null, '1537a78e1b4fb550cbb7dce7b04bcb06');
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader