Forum Discussion
Retrieve LMS User Name as Variable
Newbie here - Is there a way for the variable to retrieve the user name without the user having to click a button?
- BrianAllen9 years agoCommunity Member
Hello Jennifer,
Just add the trigger to execute the javascript to a shape positioned off the slide, and set that trigger to execute at the beginning of the timeline of your slide.
This will execute the trigger automatically and make the value available for you to use.
- JayDharap9 years agoCommunity Member
Hey Jennifer!
You set up a variable called *newName* (you could call it anything you
want, just make sure the javascript I am about to share with you has the
same variable mentioned)And then you set up a trigger to run at the start of the timeline, to
execute javascript.And in the pace where the javascript is meant to go, you enter this:
var player = GetPlayer();
var myName = lmsAPI.GetStudentName();
var arrayName = myName.split(' ');
var newName = arrayName[0];
player.SetVar("newName", newName);This works for my LMS. I'm no expert, but you can try this and ask around
if this doesn't work. There are versions of this floating around.