Retrieve name variable from Cornerstone and display it in a Storyline course
Jul 20, 2015
By
Nick Lupton
Hi,
I am having trouble with retrieving a user's name from the LMS and inserting it into a Storyline 2 course. I am using Cornerstone LMS and building courses in SCORM 1.2 (I would use SCORM 2004 but Cornerstone have issues with that...)
Below is the JS I've tried, any ideas?
var player = GetPlayer();
var myName = lmsAPI.GetStudentName();
var array = myName.split(',');
var newName = array[1] + ' ' + array[0];
player.SetVar("newName", newName);
var player = GetPlayer();
var myName = SCORM_GetStudentName();
var array = myName.split(',');
var newName = array[1] + ' ' + array[0];
player.SetVar("newName", newName);
I've got a variable in Storyline called newName
and the JS triggers when the timeline starts, or failing that, when the user presses a button on screen.
9 Replies
This is a correct code:
var player = GetPlayer();
var lmsAPI = parent;
var myName = lmsAPI.SCORM_GetStudentName();
var array = myName.split(',');
var newName = array[1] + ' ' + array[0];
player.SetVar("newName", newName);
Thanks Kamil but it still isn't retrieving the information.
Hi, Nick -- You may already be aware of this, but I just wanted to chime in and mention that although we don't provide support for JavaScript coding, it may be helpful to take a look at this document on JavaScript Best Practices. Hopefully, some of our JS experts in the community can share their suggestions!
Nick, please check if something is getting from your LMS using function alert:
var player = GetPlayer();
var lmsAPI = parent;
var myName = lmsAPI.SCORM_GetStudentName();
alert("my name "+myName);
Now you're able to see if LMS let you get something. And please check your course using other LMS f.e. cloud.scorm.
Kamil, thanks for that. The alert is showing the name. I'll have another go at getting the data to pass into a Storyline variable.
(P.S. part of the issue is that Cornerstone takes AGES to update the publication...hence the slow reply!)
Hi, Nick -- thanks for the update, and for keeping us posted! :)
Hi Nick.
I know this is old but did you get it to work with Cornerstone?
Hey Steve,
This is a bit dated and hopefully Nick is still subscribed. You are certainly welcome to reach out to the user directly via the 'Contact Me' option on the user profile if you do not hear back soon.
Do you have a way of pulling the Course Title from the LMS to display on screen?
This discussion is closed. You can start a new discussion or contact Articulate Support.