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

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Ashutosh,



Please refer this thread.


Open Outlook client from client script


I did this only but my question is:


How to set body of a mail


Hi Pradeep,



See below code i have done a bit on it.



I am getting Subject line good. i am able to set mail id also, but issue is with how to set Body of the email, see screen shot attached.



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+'');




See i want that watermark number in body but it is giving me problem.....



Thank you



wadawd.PNG


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+ '');