Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Want to Open Outlook Client Through UI Action

Ashutosh Munot1
Kilo Patron
Kilo Patron

Hi Guys,

One Quick Question for all.

I want to open outlook from UI action.

I am able to do it by using following code.

gs.setRedirect("mailto:"+current.approver.email);

Now my question is:

1) How to set body of the mail?

2) How to Set Subject of the Emai?

3)Can i call email template in this?

4) What about watermark?

I saw some of the Post.

It says that we have to write code on sys_email which sets watermark of the email.

I want a body of email and Links to approve and reject.

Thanks In Advance.

1 ACCEPTED SOLUTION

I got it....i did some modification i code and i got it.




Thank You Pradeep for your quick response...




Below is Correct code:


var subject='Re:'+current.sysapproval.getDisplayValue()+'- approve';


var gr = new GlideRecord('sys_watermark');


gr.addQuery('source_id.number',current.sysapproval);


gr.query();


if(gr.next())


  {


  var ex = gr.number;


  gs.addInfoMessage('aSHU' + ex);


  }




gs.setRedirect("mailto:ashu@example.com?subject="+subject+ "&body=" +ex+ '');


View solution in original post

8 REPLIES 8

Glad you got it resolved


shailesh1729
Tera Expert

Is it possible to send outlook invitation in same way. If yes, please guide me?


This is not possible. The RFC for "mailto" does not allow for calendar invites. In addition, there is not a separate protocol for sending calendar invites in such a way. 

Link to the "mailto" RFC: https://tools.ietf.org/html/rfc6068 

 

 

 

rajeevhanda
Kilo Expert

I tried the code as provided but still, it did not work. I then found that default email application on my PC was Google Chrome. I changed it to Outlook using the following steps:

Control Panel >> Default Programs >> Associate a file type or a protocol with a program >> Look for Email and update the correct application.