Launch Email to Include Variable Input (or Results)

Nov 04, 2020

I have utilized JavaScript coding from older articles in this platform to send an email (Outlook) that contains the results of variables stored in the lesson. In the lesson developed, the user will be able to send an email to themselves that contains the content they typed (and stored) in different variables applied in various sections of the lesson.

My problem: An Outlook email message never opens.

I believe something is wrong with my script because I added a trigger attached to a button (Send email) in the lesson as a test. It works, meaning an email message does open. However, through execution of the JavaScript it does not.

I am using Storyline 360 and here's how I setup the JavaScript:

var player = GetPlayer();
var MyStory = player.GetVar('MyStory');
var EntryEstablishExpectations = player.GetVar('EntryEstablishExpectations');
var EntryMakeTeamAPriority = player.GetVar('EntryMakeTeamAPriority');
var EntryBeInAdjustersFiles = player.GetVar('EntryBeInAdjustersFiles');
var EntryCongratulateCoach = player.GetVar(‘EntryCongratulateCoach’);
var EntryHaveYourTeamsBack = player.GetVar('EntryHaveYourTeamsBack');
var subject = 'My Diary Entries (from Drive Team Excellence)';
var body_start = 'These are my notes taken from the Drive Team Excellence Lesson.' + '\n' + '\n';
var body_end = ‘My Story: ‘ + MyStory = ‘\n’ + ‘Establish Expectations: ‘ + EntryEstablishExpectations + ‘\n’ + ‘Make Your Team a Priority: ‘ + EntryMakeTeamAPriority + ‘\n’ + ‘Be in the Adjuster's FIles: ‘ + EntryBeInAdjustersFiles + ‘\n’ + ‘Congratulate Success and Coach to Opportunities: ‘ + EntryCongratulateCoach + ‘\n’ + ‘Have Your Team's Back:’ + EntryHaveYourTeamsback;
var mailto_link = 'mailto:' + email + '?subject=' + subject + '&body=' + encodeURIComponent(body_start + body_end);
win = window.open(mailto_link, 'emailWin');

 

 This JavaScript is attached to a button that when clicked is to open an Outlook email message and include the results of six separate variables in the message body.

 

1 Reply

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