JavaScript ?: Can I pull text from a text box into an email?

I have very little JavaScript experience and would be forever grateful if someone could help me fix an issue.

I'm creating a very large branching scenario.  At the end of each branch, we are providing coaching feedback to the user regarding the pros and cons of the path they chose.

Here's what I want the Email button to do:

  • When a user clicks the Email button (see Image 1), I want an Oulook email to pop up.
  • I would like the To: in the email to be left blank.
  • In the Subject line, I would like to say "Leadership Challenge: Scenario 1 Feedback."
  • In the body of the email, I'd first like it to say "Below is the feedback you received from Scenario1 of the Leadership Challenge.  We encourage you to discuss this feedback with your Manager."
  • I would then like to pull in the text from the Feedback slide (See Image 1).

I have some of the code written already (See Image 3).  I can get the Outlook email to pop up and can populate the Subject line and the "Below is the feedback you received from Scenario1 of the Leadership Challenge. We encourage you to discuss this feedback with your Manager"  text.

The only thing left that I need is to be able to pull the actual Feedback text from the slide into the Outlook email.  Does anyone know if that is possible within Storyline?

Thank you so much!

Julie Holland

18 Replies
Kawstov FLIP

Hi Julie,

You can find reference here:

I suppose this should work.

Step 1. Create 3 variable in SL: email, subject, body_start

As the name suggest, they will contain respective content. You can fill them.

Step 2. Create a button and put a trigger to execute javascript, when clicked:


var player = GetPlayer();

var email = player.GetVar(“email”)

var subject = player.GetVar(“subject”)

var body_start = player.GetVar(“body_start”)

var mailto_link='mailto:'+email+'?subject='+subject+'&body='+body_start;,'emailWin');


If you want to email it directly, without opening outlook, (which i think is neater), goto this thread:

Do tell me, if you face any problem.



Julie Holland

Hi Kawstov,

Thanks so much for the reply.  I see where you're going with the variables...unfortunately, I have a TON of feedback slides so this would add a lot of extra work for me.  I was hoping to be able to write a piece of code on the Feedback Slide Master that pulls in whatever text is located on the Feedback slide and adds it to an email.  We are a paperless company, so I was hoping for an electronic way for the user to send/save the data in the text body.

I met with one of our Developers today and he was trying everything on the message boards and wasn't able to get it to work. 

Guess I will move this functionality to Phase 2 of the project.

Thank you!


Julie Holland

Thanks for the replies! I decided to go a different route. I’m working with our IT department to create a hidden folder on our network that only has “Read” access. I’m going to create a slide at the end of each path in my branching scenario that has a triggered button or hotspot (see image below) which will launch the user out to a file. I’m creating my feedback documents in Word and then going to .pdf them so the user can Save or Print them.

I wish there was an easier way to Print (and email) content that is located on slides in Storyline. I hope they add this type of functionality to future Storyline updates.

Thank you,


Try It Now

Hi Everyone,

I'm attempting to add javascript to a button so that it launches an email. My script appears to be working in other projects but isn't launching an email in my new course. Is there anyone who might be able to look over the script and or inspect the project to help me troubleshoot? Thanks in advance for the review!

var email="";
var subject="Feedback Needed AAA Level 1A Post-Test";
var player = GetPlayer();
var body_start=new Array();

body_text = body_start[0] + "%0D%0A%0D%0A" + body_start[1]+ "%0D%0A%0D%0A" + body_start[2]+ "%0D%0A%0D%0A" + body_start[3]+ "%0D%0A%0D%0A" + body_start[4]+ "%0D%0A%0D%0A" + body_start[5]+ "%0D%0A%0D%0A" + body_start[6]+ "%0D%0A%0D%0A" + body_start[7];

var mailto_link='mailto:'+email+'?subject='+subject+'&body='+body_text;,'emailWin');


var player = GetPlayer();

var useremail=player.GetVar("email");

var subject="VAE Engagement sur l' utilisation de velos a assistance Electrique";

var usernotes=player.GetVar("Note");

var exercisenotes1=player.GetVar("Note1");
var exercisenotes2=player.GetVar("Note2");
var exercisenotes3=player.GetVar("Note3");

var mailto_link='mailto:'+useremail+'?subject='+subject+'&body='+"Activity Notes - My thoughts on the Non-Discrimination policy:%0d%0A"+exercisenotes1+"%0d%0A%0d%0AActivity Notes - Situations I would report to the Values Line:%0d%0A"+exercisenotes2+"%0d%0A%0d%0AActivity Notes - Examples of Conflict of Interest situations:%0d%0A"+exercisenotes3+"%0d%0A%0d%0AGeneral Notes:%0d%0A"+usernotes;,'emailWin');

may be if you replace by player.GetVar("question1");
you will have the response tell me if it work

Poppy Hill

I am trying to let the user email a variable text to themselves using java script.  I have 3 variable:




I have tried and tried to plug these in to javascript, but I am inexperienced and can't get it to work!  Can anyone help me with the script I should use?  

Also, will javascript run on the HTML file vs. HTML5?  Thanks!

Feros Care

Just a minor correction, the variables should be between apostrophes, not quotation marks:

var player = GetPlayer();

var email = player.GetVar('email')

var subject = player.GetVar('subject')

var body_start = player.GetVar('body_start')

var mailto_link='mailto:'+email+'?subject='+subject+'&body='+body_start;,'emailWin');

Hi. I am trying this out but the js seem to not fire. Am I missing anything?

var player = GetPlayer();

var useremail=player.GetVar('email');

var subject="My Learning Path";

var usernotes=player.GetVar('notes');

var exercisenotes1=player.GetVar('Thoughts1');
var exercisenotes2=player.GetVar('Thoughts2');
var exercisenotes3=player.GetVar('Thoughts3');

var mailto_link='mailto:'+useremail+'?subject='+subject+'&body=
'+"Activity Notes - My thoughts on the Non-Discrimination policy:%0d%0A“
Activity Notes - Situations I would report to the Values Line:%0d%0A“
Activity Notes - Examples of Conflict of Interest situations:%0d%0A“
+exercisenotes3+"%0d%0A%0d%0AGeneral Notes:%0d%0A"+usernotes;,'emailWin');