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?
Ah! Found a problem. You need to create the variable in the variable manager. Otherwise the SetVar call won't work and the %newName% macro will just pull from nothing. I'm guessing it'll just continue to display %newName%, correct?
Hi Stephanie! Brian's response was over a year ago, so I'm not sure if he would still be subscribed to the thread. You are welcome to reach out to him directly via the 'Contact Me' option on his user profile.
Hello! I'm having some trouble getting a Student ID to display. I set an alert to get the Student ID and it pops up with the info displayed perfectly, but I can't seem to transfer that StudentID variable into my Storyline project. Here is my code:
var player = GetPlayer ();
var learnerID = lmsAPI.GetStudentID();
player.SetVar("learnerID", learnerID);
It might help to note that we use Cornerstone for our LMS. Any ideas?
Hopefully someone will chime in to assist you here or you are welcome to reach out to users directly via the 'Contact Me' option on their user profile if needed.
I did want to pop in and let you know that we have a pretty extensive thread with our Cornerstone LMS users that I thought you might want to know about for sure :)
Thanks for the reply, Steve! I had tried adding that line earlier, thinking that was the problem, but had no luck. I must have just messed up the code somehow because it's working now.
I'm now trying to use the same script as my earlier post to grab the course ID (replacing StudentID with CourseID and learner with course in script), but can't seem to get it to return. I've tried to set up an alert like this:
alert(lmsAPI.GetCourseID());
But no pop-up message appears. I tried to add the var lmsAPI = parent line, but no luck. I double checked the variable name in the AICCFunctions.js file and there is a variable titled AICC_CourseID. Any idea why this isn't coming back for me, yet I get the StudentID with no problem?
This forum discussion is a bit older and as such I'm not sure that folks are still subscribed. You may want to reach out to them directly using the "contact me" button on their profiles.
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.
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.
214 Replies
but, my name still does not appear on the screen in the course itself.
Ah! Found a problem. You need to create the variable in the variable manager. Otherwise the SetVar call won't work and the %newName% macro will just pull from nothing. I'm guessing it'll just continue to display %newName%, correct?
OMG! cannot believe we forgot to add it to the variable manager! Testing now.
That did it Steve. I can't believe it. I am 13 hours in on a marathon day. Example of the law of diminishing returns - possibly.
I really appreciate the help.
Thank you Steve!
Brian, I would love a copy of this as well... Any way that you can send it to me? I am at my wits end. Thanks!
Hi Stephanie,
I've added the missing variable and tested it in Scorm Cloud. It works now. See attached.
Hi Stephanie! Brian's response was over a year ago, so I'm not sure if he would still be subscribed to the thread. You are welcome to reach out to him directly via the 'Contact Me' option on his user profile.
Hello! I'm having some trouble getting a Student ID to display. I set an alert to get the Student ID and it pops up with the info displayed perfectly, but I can't seem to transfer that StudentID variable into my Storyline project. Here is my code:
var player = GetPlayer ();
var learnerID = lmsAPI.GetStudentID();
player.SetVar("learnerID", learnerID);
It might help to note that we use Cornerstone for our LMS. Any ideas?
Hi Matt!
Hopefully someone will chime in to assist you here or you are welcome to reach out to users directly via the 'Contact Me' option on their user profile if needed.
I did want to pop in and let you know that we have a pretty extensive thread with our Cornerstone LMS users that I thought you might want to know about for sure :)
Thanks, Leslie! Didn't know about the Cornerstone user thread.
Try adding this before you call lmsAPI.GetStudentID():
lmsAPI=parent;
I must have had a typo in my code in the trigger I set up. I just recreated the trigger with the same code as above and was successful.
Sweet! Glad to hear you got it working. I love this thread...
Thanks for the reply, Steve! I had tried adding that line earlier, thinking that was the problem, but had no luck. I must have just messed up the code somehow because it's working now.
I'm now trying to use the same script as my earlier post to grab the course ID (replacing StudentID with CourseID and learner with course in script), but can't seem to get it to return. I've tried to set up an alert like this:
alert(lmsAPI.GetCourseID());
But no pop-up message appears. I tried to add the var lmsAPI = parent line, but no luck. I double checked the variable name in the AICCFunctions.js file and there is a variable titled AICC_CourseID. Any idea why this isn't coming back for me, yet I get the StudentID with no problem?
Hello!,
It works in SCORM 1.2 but if I want to know the User's ID. How can I get it?
Hi Eduardo,
This forum discussion is a bit older and as such I'm not sure that folks are still subscribed. You may want to reach out to them directly using the "contact me" button on their profiles.
This post was removed by the author
Hi Eduardo,
You'll need to click on the user's name to visit their profile. Then you'll see a "contact me" button to reach out to them specifically.
Thank you Ashley!
Newbie here - Is there a way for the variable to retrieve the user name without the user having to click a button?
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.
set the trigger to on timeline start of a slide
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.