Forum Discussion
LewisEigen
8 years agoCommunity Member
Getting student name from the LMS and using it in Articulate
In the LMS we are about to use, we can get the student name since the SCORM runtime variable for it is "cmi.core.student_name". However, how do I get it as a variable in Articulate at run time?
k1967hHayes
6 years agoCommunity Member
This code is working for me on Totara - sadly I can't advise on it as I either found it within this thread or a previous discussion:
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[1] + ' ' + array[0];
player.SetVar("newName", newName);
var lmsAPI = findLMSAPI(this);
var StudentID = lmsAPI.Getstudent_id();
player.SetVar("StudentID", StudentID);