Help with JavaScript and pulling data from an LMS

Jul 31, 2012

I know virtually nothing about writing JavaScript but was hoping for a little love from the group. I was interested in an earlier post about retrieving learner names from an LMS using JavaScript ( and wanted to try to extend that to trying to retrieve other data like the Department ID or Job Code.

I got the JS from Phil for the learner name and it works great:

var player = GetPlayer();

var myName  = lmsAPI.GetStudentName();

var array  = myName.split(',');
var newName = array[1] + '  ' + array[0];

player.SetVar("newName", newName);

//myName = player.GetVar('myName');

//player.SetVar("newName", newName);

How would I modify this for a field called "DeptID" in the LMS?

Thanks to all,


42 Replies
Joseph Francis


Please explain why Articulate defers support of the scripting language, which it intentionally baked into Storyline, to the community at large. This is not a plug-in like the old Macromedia XTRAS which enhanced the functionality of Director, but were supported by the 3rd party company from which they originated. Javascript is part of the Storyline codebase, and it comes as part of the tool.

While a huge repository of Javascript programming conventions does exist, if the development tool we are writing the Javascript in does not execute the code properly, no amount of work-arounds will fix the fact that the development tool, Storyline, is broken.

Joseph Francis

Storyline does not accurately retrieve the Lesson_Status (Status) from the LMS. What is does retrieve, it transposes from the AICC-defined standard values (Passed, Completed, Failed, Incomplete, Browsed, Not Attempted) to numerals (1-6). However, it is not retrieving the same thing the built-in debugger is.

You would be incorrect in asserting that Articulate cannot troubleshoot Javascript code for the users, because Articulate baked the Javascript into Storyline's codebase. While there isn't an expectation of the staff to assist in writing code, expectation that the code written would execute IS warranted. If I query the LMS from within the course about the student's completion status, and the response continues to be "Incomplete" (even though the debugger shows a status of "Passed"), then that is something Articulate needs to acknowledge, own, and correct.

Mike B.

I thought you were referring to custom code not being executed. This sounds like something that would warrant opening a support case, to have a higher-level tech assist you, unless someone here is familiar with calling that data from LMS.

Can you share some sample code? I'd be happy to test it on our LMS to see if I get a similar result.

Steve Flowers

Joseph - 

The returned numbers within GetStatus() are, I assume, intended as an internal abstraction rather than broken as you're asserting here. The values you want are there if you walk up the chain. You can go up one level to the source in the API and grab the values you want from the LMS.

Call this to retrieve the string value from the LMS. 


This will return the normalized values passed, failed, completed, incomplete, not attempted. --Unless your LMS returns single letter values. If yours doesn't and you need the single letter value, a substring operation will get you what you need.

The LMS products I've used return the normalized values.

Steve Flowers

Another way to grab the internal status regardless of whether it's been passed to the LMS, which I'm not sure is possible as I haven't been able to set off an event within SL that would trigger a change in status without a correlating call to change it on the LMS.


**just noticed this is not displaying exactly what I expected. Still usable and consistent. Another internal variable that's employed through abstraction with a library between use and the API wrapper. Incomplete = Incomplete. Passed = Pass, Completed=complete.


Ashley Terwilliger-Pollard

Hi Joseph,

As Mike and Steve helped clarify this thread is particularly long and a lot of information shared. Without knowing the specifics of what Javascript was being referred to, I shared our general information in regards to the writing and editing of Javascript code within triggers or custom set ups to communicate variables to and from Storyline and the LMS. Storyline also does not allow for the accessing of system variables as detailed here.

As for reporting the values of the course status between Storyline and your LMS, if you believe something is not being passed correctly as Mike mentioned it'll likely be something we'd want to get our team to take a look at. We'd also want to confirm that the same behavior exists within SCORM Cloud (an industry standard for testing LMS content) to help isolate the issue to the Storyline file set up or the LMS. 

If you're able to replicate there or would like to work with our Support Engineers for further testing, please reach out to them here and upload your project file. 

Barry Langton


I know this thread is old but it's the best I found so far that is close to want I'm trying to do. The problem I have is there is no documentation on storyline communicating with the LMS using SCROM functions. I understand how to do external javascript and call SCORM functions and I can see the functions inside the file included with storyline (LMSAPI.js SCROMFunctions.js) and I understand SCORM. 

I can even get the studentName data from the LMS and the read and write comments.

But the whole list of SCORM functions, don't work - it should be easy if you can use javascript and you have the the scorm wrapper.

So what I am wondering is - does storyline block or disrupt the full SCORM functionality? IS there ANY document/resources on this area from Storyline - NOT how do do external javascript?


Specifically I'm struggling to get suspend_data and GetBookmark (cmi.core.lesson_location) to work.



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