Need Javascript to open Outlook and send email from inside sl360

Dec 21, 2022

I am a novice at JS.  Can anyone make this javascript open Outlook, send an email to a specific mailto: address, so learners can ask questions?

Here is my current JS

var player = GetPlayer();
var email='';
var subject='VCI Complaint Management Question';
var feedback=player.GetVar('MyQuestion');
var emailBody = +feedback
var mailto_link='mailto:'+email+'?subject='+subject+'&body='+encodeURIComponent(emailBody);
win=window.open(mailto_link,'email@xxxx.com');

8 Replies
Walt Hamilton

I'm not in a position to test your script, but one thing comes to mind. If it isn't working at all (you didn't say what is happening,) you might consider changing ' to ".  There have been reports of SL having problems with changing ' to something that doesn't work.

Also, if you are using Outlook as a generic term to mean email app, fine. But if you want Outlook specifically, the mailto command opens the default email, and is under the control of the settings on the learner's computer, not yours.  See Maria's first post in this thread:

https://community.articulate.com/discussions/articulate-storyline/javascript-for-sending-storyline-360-text-entries-via-email

Jürgen Schoenemeyer

try

var player   = GetPlayer();
var feedback = player.GetVar('MyQuestion');

var email = 'email@xxxx.com';
var subject = 'VCI Complaint Management Question';

var emailBody = feedback;
var mailto_link = 'mailto:'+email+'?subject='+subject+'&body='+encodeURIComponent(emailBody);

window.open(mailto_link,'_self');

result:

https://360.articulate.com/review/content/f30e9e0a-7c08-4180-bea3-b99aa966e36d/review