Storyline 360: LMS Name JavaScript issue with SCORM 2004 4th Edition

May 01, 2019

Hi

Appreciate there are several threads on 'pulling learner name from LMS' already, but I've gone through all of the discussions and am still struggling!

I had a piece of working code that was pulling the learner name from the LMS and storing it in a storyline variable. Here's what I was using:

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);

This worked perfectly in SCORM 1.2, but unfortunately I've had to republish to SCORM 2004 4th edition. This is because the LMS that I use (Kallidus) appears to enforce a suspend data limit and 1.2 does not cover the entirety of the course.

I've amended the above code to the following, as per advice in other threads by Kamil Nowek and Steve Flowers respectively:

var player = GetPlayer();
 
var myName  = lmsAPI.SCORM2004_GetStudentName();
 
var array  = myName.split(',');
var newName = array[1] + ' ' + array[0];
 
player.SetVar("newName", newName);
 
//myName = player.GetVar('myName');
 
//player.SetVar("newName", newName);
var player = GetPlayer();
 
var myName  = SCORM_GetStudentName();
 
var array  = myName.split(',');
var newName = array[1] + ' ' + array[0];
 
player.SetVar("newName", newName);
 
//myName = player.GetVar('myName');
 
//player.SetVar("newName", newName);

Unfortunately I've had no luck with either. I've also tried lots of different code strings using variables such as 'first_name', 'last_name' but this either returns a blank or crashes the course.

Any help greatly appreciated as I'm beginning to lose the will with this one!

Luke

Be the first to reply

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