Forum Discussion
ALitchfield
22 days agoCommunity Member
Javascript to pull User Name in Reach 360
Hello! I am wondering if anyone has figured out the javascript to pull the users name from Reach 360.
I set the variable to firstName in Articulate 360 and this is the javascript I put in. Any help is appreciated!
var player = GetPlayer();
function findLMSAPI(win) {
if (win.hasOwnProperty("GetStudentID")) return win;
else if (win.parent == win) return null;
else return findLMSAPI(win.parent);
}
var lmsAPI = findLMSAPI(this);
var myName = lmsAPI.GetStudentName();
var array = myName.split(',');
var firstName = array[1].trim();
var lastName = array[0].trim();
player.SetVar("username", firstName);
No RepliesBe the first to reply