Forum Discussion
Getting student name from the LMS and using it in Articulate
Publishing Using HTML5 on Cornerstone LMS, This code was sort of working but giving me a duplicated name...
By modifying it slightly I was able to get rid of the duplication and have the full name display.
I was hoping to separate the first and last name, but (after 22 attempts) I've decide to settle with it working this way.
The on-slide reference display variable is: %newName%
and the JS code was as follows:
var player = GetPlayer();
function findLMSAPI(win) {
// look in this window
if (win.hasOwnProperty("GetStudentID")) return win;
// all done if no parent
else if (win.parent == win) return null;
// climb up to parent window & look there
else return findLMSAPI(win.parent);
}
var lmsAPI = findLMSAPI(this);
var myName = lmsAPI.GetStudentName();
var array = myName.split(',');
var newName = array[0];
player.SetVar("newName", newName);
Thanks for the starting point!
Do you have a sample course I could look at please? I found TRAINEE.FIRST.NAME and TRAINEE.LAST.NAME in our Email settings on CSOD but I am not sure how to make it work.