BrycePoole-1cf0
7 months agoCommunity Member
JavaScript returning with "Preview" when trying to pull user names from LMS
Hi everyone,
I have run across this before but don't recall what I did to correct it, I am trying to pull the learners first and last name from the LMS and when I test in the LMS the system shows Preview rather than my name, I will share the JavaScript below.
var player = GetPlayer();
var myName = lmsAPI.GetStudentName();
var array = myName.split(',');
var newName = array[1] + ' ' + array[0];
player.SetVar("var_fullname", newName);
var firstName = array[1];
player.SetVar("var_firstname", firstName);
var lastName = array[0];
player.SetVar("var_lastname", lastName);
Any assistance that can be offered will be greatly appreciated.
Bryce