Forum Discussion
Retrieve LMS User Name as Variable
I know you can have a user fill in a text box with their name and then later use that variable for personalization. What we would like to do is programmatically retrieve the user name from the LMS. Is there a way to set a variable with data from the LMS when the course is loaded instead of having the user enter their name?
Thx
215 Replies
Great news Rick :)
- JamesBonney-EDECommunity Member
Hi Steve,
For some reason when publishing from 360 with HTML 5 and flash as a fallback, the code doesn't work anymore.
Anyone got any ideas?
- SteveFlowersCommunity Member
Hi, James - Which code are you using? This works for me in HTML5 publish.
var player=GetPlayer();
lmsAPI=parent;
var username=lmsAPI.GetStudentName();
player.SetVar("SLVariable",username);
//alert(username);- OgbishBarrowCommunity Member
Hello, please may I ask - is this the code for retrieving names from LMS? if so, where do I insert it. I am pretty new to Articulate
- ChrisPim-7dc640Community Member
Any resolution to this I can't get this working in 360 HTML5 output in any browser
-------------------
var player=GetPlayer();
lmsAPI=parent;
var username=lmsAPI.GetStudentName();
player.SetVar("SLVariable",username);
//alert(username);----------------------
Anyone got this working?
- JamesBonney-EDECommunity Member
Hi Steve,
Cheers for that, I'll give that one a go.
I was using the most recent code you posted previously (to me) on page 6 of this thread.
With 360 giving us the option for a preferred HTML5/Flash priority, how is this going to affect the choice of code we use? Could we encounter certain code not working depending on the format the course launches in?
Or would we need two triggers for the two different types of JS code? 1 for HTML5 and 1 for flash?
- SteveFlowersCommunity Member
Nope. Since the JS executes in the client browser, shouldn't matter which packaging is used.
- JamesBonney-EDECommunity Member
Thanks Steve, do you know why the codes just stop working?
As I said the code on page 6 worked for me on SL2, but not 360.
- JamesBonney-EDECommunity Member
Hmm I cant get that code to work for me Steve, I'll try again tomorrow and let you know.
ThanksJames
- OgbishBarrowCommunity Member
Hello Andrew, please can you tell me what exactly worked for you, and how I may go about using it. Is there a video?
- SallyMilfordCommunity Member
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).
I've read through this discussion but I'm very green and have had no experience with javascript functions (and only basic variables).
Any help for dummies would be amazing.
Thanks,
Sal
- LucioCommunity Member
Hi Sally,
Which app are you using?
Related Content
- 3 years ago
- 9 months ago
- 9 months ago