Forum Discussion
SallyMilford
8 years agoCommunity Member
Pulling first name from LMS
Hi all - I'm wondering if anyone might be able to put together a step-by-step guide as to how to set up a variable / javascript function for this? (i.e. pulling a user's first name from the LMS).
...
Lucio
4 years agoCommunity Member
Hi Glenda,
From what I see in your code, you must declare the "player" variable before making the API call.
Try this:
var player = GetPlayer();
var StudentNameIn = lmsAPI.GetStudentName();
var array = StudentNameIn.split(',');
var StudentName = array[1] + ' ' + array[0];
player.SetVar("StudentName", StudentName);
If you wish to split the name in two variables, you may use your approach instead of "StudentName".