How to call emailClientOpenPop() in UI action?

winniechim
Kilo Contributor

Hi all,

I'm very new to the system Email functions.

I want to show a send email pop up when client click a button.

So I create an UI Action and research that there is a emailClientOpenPop() function in system.

New my obstacle is I have no idea where emailClientOpenPop() is, what are the parameters needed and how to call it from the UI Action Onclick/script.

Many thanks for any advise!

Winnie

1 ACCEPTED SOLUTION

billi_lumley
ServiceNow Employee
ServiceNow Employee

Within the Onclick field on the UI Action, simply add:


emailClientOpenPop('table_name'); (ie, emailClientOpenPop('incident');)


View solution in original post

7 REPLIES 7

coryseering
ServiceNow Employee
ServiceNow Employee

Hi Winnie,



emailClientOpenPop is defined in popups.js and should be available on any table.



The function takes these params:


table, immediate, replyType, replyID, addOn



This is the function definition so you can see what is being done with each param:



function emailClientOpenPop(table, immediate, replyType, replyID, addOn) {


      var id = document.getElementsByName("sys_uniqueValue")[0];


      if (!id)


              return;



      var url = new GlideURL("email_client.do");


      url.addParam("sysparm_table", table);


      url.addParam("sysparm_sys_id", id.value);


      url.addParam("sysparm_target", table);


      if (replyType != null) {


              url.addParam("replytype", replyType);


              url.addParam("replyid", replyID);


      }



      popupOpenEmailClient(url.getURL() + g_form.serializeChangedAll());


}



And most of those are optional:


emailClientOpenPop(table, false, null, null, '');


(table is the table name you are viewing the form for, like 'incident' or 'change_request');


Dear coryseering,

 

Where can I find the "popups.js" file?

I need to check its contents because for some strange reasons, the "sysparm_sys_id" parameter in the URL of the pop-up window does not contain any sys_id value. This prevents my outbound emails (send from Reply, Reply All or Forward actions) from appearing in the Activity Formatter, even if they are succesfully relayed to the recipient.

 

Thanks,

Mihail

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Winnie,



Populate the OnClick with emailClientOpen(this,'incident'); //Replace incident with the table name of the UI action created on.


Please refer the below screenshot for reference.


Screen Shot 2015-08-20 at 10.37.33 AM.JPG


billi_lumley
ServiceNow Employee
ServiceNow Employee

Within the Onclick field on the UI Action, simply add:


emailClientOpenPop('table_name'); (ie, emailClientOpenPop('incident');)