Update ticket and open 'Email Client Template' in a single UI Action

Jason Nicholas
Tera Expert

Hi

 

I am trying to create a UI action that does 2 things

  1. Pop up a Client email
  2. 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.

2 ACCEPTED SOLUTIONS

You need to use gsftSubmit() to make both calls.

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB1005843

https://www.servicenow.com/community/itsm-articles/client-side-and-server-side-code-in-one-ui-action...

https://www.youtube.com/watch?v=yyVnpbidwmE

 

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

View solution in original post

hi, in this video we are talking about calling one UI action from another ui acion If you have any query please connect with us on Facebook https://www.facebook.com/ServiceNowKida/ if you find my video useful, please like and share my video and don't forget to subscribe my channel- ServiceNow Kida

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);   
}

 

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

View solution in original post

10 REPLIES 10

Ankur

 

Please see my response to Anil, I had it fixed in Dev but does not work in Prod

 

Jason