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

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

 

View solution in original post

10 REPLIES 10

Anil Lande
Kilo Patron

Hi,

can you please share complete UI Action screenshot?

 

Anil Lande
Kilo Patron

Hi,

You can call script include using glideAjax in your client callable function.

In your script include function you can update current record (server code) and return true/false.

Once you are back you can call email client function .

No need to write server side code in UI Action.

 

 

Jason Nicholas
Tera Expert

JasonNicholas_0-1702477247197.png

 

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