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?
You can try a couple of things to troubleshoot the issue.
1) alert(lmsAPI.GetStudentName());
If your student name returns in the alert, the method is working and there's another problem. If it doesn't, try this:
2) var lmsAPI = parent;
alert(lmsAPI.GetStudentName());
It could be that your LMSAPI is nested in a parent. This jacks up the reference. If #2 returns your student name, let us know and we'll recommend a change to the original script.
Neither of the above suggestions seem to be working. They both return blanks. It may be the case that this feature is not supported by the LMS. Any other suggestions?
I'm not sure if I did it correctly, but when I call the function lmsAPI.GetLastError() it returns 0. Still, it is not pulling the student name though...just a blank.
Does anyone have more sugesstions to try? The fact that it is returning a blank( ie. " , ") it seems the code is working fine, but it is not grabbing the name properly from the LMS. Is it possible that the LMSAPI is nested in more than 1 parent? I initially felt good about this code:
var lmsAPI = parent;
alert(lmsAPI.GetStudentName());
But when that didn't work, I thought maybe the idea of nested parents could be taken further. Stop me if I don't know what I'm talking about here, just trying to get this to work somehow.
When the error code is 0 (no error) and the LMS in fact returns something (the ","), your call to the API is working. Are you sure, that the LMS ever registered a not-empty name for the user? You can check, if the user has a real name in the LMS user interface.
In the LMS user interface, the student's name is visible at the top of the page when they log in. Also, they are able to generate certificates for courses and those contain their name as well.
I am doing the same thing trying to get the Users ID or Email from the LMS. I am trying to have a promotion in the course that will give the Users ID or Email over to a website that will randomly select a winner for a prize. I want to use something more than just the users name because there maybe people with the same name. I need help getting this info and then giving it to a website to see if they can win. thanks for any help you can give.
I am trying to pull the users "business area" from the LMS so I can bespoke parts of the learning to meet their specific roles/needs, however, I have tried amending the above script but no joy so far.
Any ideas? The data is stored in the LMS as Division
Has anyone had any success in pulling division/dept from the LMS? If so, could you possibly share the code?
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?
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.
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.
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?
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
214 Replies
Hi, Vince -
You can try a couple of things to troubleshoot the issue.
1)
alert(lmsAPI.GetStudentName());
If your student name returns in the alert, the method is working and there's another problem. If it doesn't, try this:
2)
var lmsAPI = parent;
alert(lmsAPI.GetStudentName());
It could be that your LMSAPI is nested in a parent. This jacks up the reference. If #2 returns your student name, let us know and we'll recommend a change to the original script.
Neither of the above suggestions seem to be working. They both return blanks. It may be the case that this feature is not supported by the LMS. Any other suggestions?
Thanks again.
Student name is a mandatory Scorm data element, so the lms has to support it. I suggest, that you call the Scorm methods for getting the last error.
I'm not sure if I did it correctly, but when I call the function lmsAPI.GetLastError() it returns 0. Still, it is not pulling the student name though...just a blank.
Does anyone have more sugesstions to try? The fact that it is returning a blank( ie. " , ") it seems the code is working fine, but it is not grabbing the name properly from the LMS. Is it possible that the LMSAPI is nested in more than 1 parent? I initially felt good about this code:
var lmsAPI = parent;
alert(lmsAPI.GetStudentName());
But when that didn't work, I thought maybe the idea of nested parents could be taken further. Stop me if I don't know what I'm talking about here, just trying to get this to work somehow.
When the error code is 0 (no error) and the LMS in fact returns something (the ","), your call to the API is working. Are you sure, that the LMS ever registered a not-empty name for the user? You can check, if the user has a real name in the LMS user interface.
In the LMS user interface, the student's name is visible at the top of the page when they log in. Also, they are able to generate certificates for courses and those contain their name as well.
You're testing this in Flash, correct?
Correct.
You might test your course in ADL Sample Run Time Environment or in SCORM Cloud. If it works there, you have a good argument against your LMS vendor.
I am doing the same thing trying to get the Users ID or Email from the LMS. I am trying to have a promotion in the course that will give the Users ID or Email over to a website that will randomly select a winner for a prize. I want to use something more than just the users name because there maybe people with the same name. I need help getting this info and then giving it to a website to see if they can win. thanks for any help you can give.
Did some searching and stumbled across this forum. Just a couple questions about this and hoping someone might have an answer.
1) Has anyone figured out a way to get this working with HTML 5 yet?
2) Has anyone gotten this to work on the Skillport LMS?
Thank you in advanced to anyone who might have an answer!
I am trying to pull the users "business area" from the LMS so I can bespoke parts of the learning to meet their specific roles/needs, however, I have tried amending the above script but no joy so far.
Any ideas? The data is stored in the LMS as Division
Has anyone had any success in pulling division/dept from the LMS? If so, could you possibly share the code?
Thanks
I got some help in the same area, here:
https://elearningenhanced.com/blog/2012/08/15/grabbing-student%E2%80%99s-name-lms-storyline
Thanks!
Works great... once I realised it's caps sensitive.
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("
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.
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.
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
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?
Hello Chris
If the name is in a variable called stName, you can use this:
stName = stName.charAt(0).toUpperCase() + stName.slice(1);
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);
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.