Forum Discussion
Getting student name from the LMS and using it in Articulate
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.
Thank you so much for this. Even though this was published so long ago, it helped me this morning when my js snippet stopped working. For some reason var myName = lmsAPI.GetStudentName(); was working in my Storyline file for quite some time and then stopped. I suspect that Moodle was updated or something. Anyway. I changed lmsAPI to SCORM_ and now it works and retrieves the student's first name. I am eternally grateful!