Forum Discussion
Retrieve LMS User Name as Variable
The lmsAPI.GetStudentName(); method no longer works for me when I publish to HTML5 only. Here's the code that I use for HTML5:
//This trigger is set to execute when the timeline starts. In order for it to work, this slide requires a variable "newName".
//Get User Name embedded into file from LMS
var myName = SCORM_GetStudentName();
//SCORM has last name, first and we are switching it around to first last.
var array = myName.split(',');
var newName = array[1] + ' ' + array[0];
//Set the variable
var player = GetPlayer();
player.SetVar("newName", newName);
FYI, we’ve found that although the lms.js file is still included in the published HTML5 zip package, it’s not actually used and all its functions and variables aren’t used in our LMS. I’m not sure if that has something to do with our LMS (Saba Cloud) or something else. Regardless, that’s why the lmsAPI variable is undefined in our LMS. Instead I used the SCORM_GetStudentName(); function from SCORMFunctions.js.