Email quiz results using java script

Feb 02, 2015

I'm new to Storyline.  I found an article detailing how to insert java script to email quiz results since my company doesn't use an LMS.   I'm attaching what I've done so far but it doesn't seem to work.   

Here's the java script I used:

var player = GetPlayer();
var subject=”Results”;
var body_start=player.GetVar(“NumericEntry”);
body_text = body_start;
var mailto_link=’mailto:’+email+’?subject=’+subject

Thanks for your help!




16 Replies
Steve Flowers


That will also probably kick an error and cause it to fail. The email should be a string like this:

var email="";

While email can work. I generally prefer to use some kind of server side end-point as it's less steps for the user and doesn't rely on an email client. Some users with gmail / similar might have problems launching the right application. It's a little more complicated but if you're interested and able to run that route, I'll post some refs where you can drop all kinds of things into a Google Spreadsheet. Good for record keeping to boot:)

Steve Flowers

Hey Matthew - 

Give this a try. I used a Google Form as an endpoint in this example. Two different JS Triggers. One loads JQuery into the document head. The other executes to send data via POST. This is the simplest way I could find to do it. The delay was necessary for one of the browsers I tested as far as I remember. Could be for mobile / iOS. Don't remember:)


Liliana Lucy

Hi Matthew,

I am fairly new to Storyline so I'm not sure what you mean by sharing the storyline file. If you can be very specific I can send you what you need.
I did add the quotation marks.
Not sure what you mean by testing locally. I put my email address in the script. Nothing happened.

Sorry. I know I'm asking very basic questions. I do thank you for your help.

Lily Cisneros Lucy
Learning Specialist
AAA Northern California, Nevada & Utah
1900 Powell Street, 10th Fl.
Emeryville, CA 94608
Office Phone:510 596-4849

Jackson Hamner

After looking at your code I think I found your problem. It has to do with the quotation marks and making sure they are formatted correctly.

In two place, the Subject and the GetVar part the quotation marks were incorrectly formatted (facing the wrong direction or something). After replacing them i got your code to work. Here is the fixed code that worked for me. 

var email="";
var player = GetPlayer();
var subject="Results";
var body_start=player.GetVar("NumericEntry");
body_text = body_start;
var mailto_link='mailto:'+email+'?subject='+subject+'&body='+body_text;,"emailWin");

This can happen sometimes if you write your code in word processing software like Microsoft Word with autocorrects, or if you edit the code a lot and the quotes get misaligned. I've attached a copy of the story file that I got it working on, but its a SL2 file so Im not sure itll be much help...

A suggestion I have would be to download something like Notepad++ and use that to write your javascript. It has some styles that help make sure your code is correct (if its a string the text is grey, a variable is blue, etc.) thats how I noticed the quotes weren't aligned correctly and fixed them.

Also if the Travel_Geography_SF story file I noticed you put quotes around the whole script and you don't need those, it will mess up the script.

Hopefully this helps!


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