Java Script Email

Oct 01, 2019

Hello,

 

I am trying to create a JavaScript code where it pulls in the colleague's name (EEName) and am trying to send a hyperlink through the body of the email.

 

Can someone who is familiar with JS check over this code and see if this looks accurate? Any help would be appreciated as I am not that familiar with JS.

 

Thanks!

 

 

var EEName = player.GetVar('EEName');
var player = GetPlayer();
var email = player.GetVar('MgrEmail');
var subject = 'Your Offboarding Checklist for ' + 'EEName';
var emailBody = 'Hello' + '\n' + 'Please see your offboarding checklist for ' + 'EEName' + '\n' + 'https://thezone.corp.zoetis.com/hrforme/USA/_layouts/15/WopiFrame.aspx?sourcedoc={8BFB842F-3611-4BE9-8ECB-39C6B68A31A8}&file=Manager%20Separation%20Checklist_rev3_28_18.docx&action=default';
window.location.href='mailto:'+email+'?subject='+subject+'&body='+encodeURIComponent(emailBody);

6 Replies
Kevin Merendino

Eureka !! I was able to figure it out :)

So I forgot that I created duplicated pages with the the incorrect line below and I'm assuming that is why it wasn't working.

Also, why would this code be an error? I do want to send other custom emails with URL's and other verbiage so just so I can create these other emails with ease it would be good to know some best practices when creating a custom email body with JS.

 

Thanks for your help!

 

var emailBody = 'Hello' + 'Here is your offboarding checklist to help with a smooth offboarding for' + EEName:' + '\n' + fbk;

 

This discussion is closed. You can start a new discussion or contact Articulate Support.