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
- IsraelRodriguezCommunity Member
I'm trying to generate a certificate that contains the name of the student. I created a button that opens an html file with the certificate design, and the code I'm using is:
var player=window.opener.GetPlayer();
var learnerName=player.GetVar("newName");
document.write("" +learnerName+ "");Yet, I'm getting undefined as a result. What am I doing wrong?
Hi Israel, and welcome to Heroes!
Although we don't support the creation of certificates, I wanted to point you to this KB article with a few methods described. Additionally, this thread with an example from Steve Flowers is a popular one, and a great place to discuss customizing the certificate further.
- IsraelRodriguezCommunity Member
Hi Ashley, thanks for your answer.
I actually did base my certificate on Steve Flowers' example and following some of the posts on that thread.
However, I'm still getting "undefined". Moreover, using firebug to debug js I found out that lmsAPI.js functions are not working as if the .js file was not being loaded.
I'm not a Javascript expert ( or even a novice) so I'll defer to someone in the community to help you out! You may also want to post in that other thread if you didn't already - Steve Flowers is generally pretty good at getting back to people there.
- ChrisFCommunity Member
Does anyone have the Javascript that changes the first letter of username (pulled from lms) to a capital?
I have seen it on the forums somewhere, but cannot seem to find it.
Hi Chris! Hope you get some assistance from the community with this
- AlexYong1Community Member
Hello Folks!
Just wanted to re-post my question about this. Has anyone figured out how to get this to work with the HTML 5 output so the experience will be the same on a tablet?
- JørgenNielsenCommunity Member
Hello Chris
If the name is in a variable called stName, you can use this:
stName = stName.charAt(0).toUpperCase() + stName.slice(1);
- DanielIveyCommunity Member
I already have a storyline certificate which publishes the StudentName from the LMS and Date from the users computer, however I was hoping to add the Student ID. I don't know much javascript so apologies for the poor chopped code!
Here is what I have so far, I'm assuming Student ID from the LMS is just GetStudentID?? And employeeID is the variable I'm using in Storyline
var player = GetPlayer();
var employeeID = lmsAPI.GetStudentID();
player.SetVar("employeeID", employeeID);
- CaesarAycochoCommunity Member
thanks. this thread is really an eye opener. i like the fact that you can pull LMS data and use it in your Storyline course.