Cornerstone learner name


We've just started using Cornerstone Ondemand as our LMS and have a issue pulling the learner name from the LMS into the course using Javascript, from a SORM 2004 v3 output. I have a script that worked in their sandbox but it doesn't work in the live environment. The script I'm using is;

var player = GetPlayer();
function findLMSAPI(win) {
// look in this window
if (win.hasOwnProperty("GetStudentID")) return win;
// all done if no parent
else if (win.parent == win) return null;
// climb up to parent window & look there
else return findLMSAPI(win.parent);

var lmsAPI = findLMSAPI(this);
var myName = lmsAPI.SCORM2004_GetStudentName();
var array = myName.split(',');
var newName = array[1];
player.SetVar("newName", newName);


Would really appreciate some help, so we can get our courses transferred.


12 Replies
Przemysław Hubisz

Hi Jeremy,

I checked it on it looks like Cornerstone returns Name and Surname as an array with Name and Surname ["John Doe"] but it is not split by comma as expected in the formula ["John, Doe"].  So when you try to do this var array = myName.split(',') you get Array with only one item and this part var newName = array[1] return undefined as there is no second position in the array. Can you check it on your side? Please change the old line of code with this: var array = myName.split(' ');

Hope it helps,


Dave Rosenfeld

Hi Jeremy. Thanks. It turns out you can't grab username via the SCORM functions that are available. That being said!...

I was able to pull in User IDs, but they are DIFFERENT ID #s than what's in our company LMS.

Do you have any insight on that. I'm reaching out to Cornerstone about it as well. My thoughts are that this could be pulling in a Cornerstone generated ID, vs. their Employee ID within the system.

Dave Rosenfeld

We just learned that it's pulling something called the "Target User ID" - which is in the URL in the browser bar. It's "Cornerstone generated". Why would this SCORM2004 function be pulling that User/Student ID #? 


Is SCORM2004, 3rd edition not the best specification to be using for this?


Jeremy Usher

Hi Dave

I'm no expert on Cornerstone, we're only just finishing implementation, and Javascript, I tend to use what I find on the Articulate forums and tweak a bit. So I don't think I can help any further, with this code.

I have found the API.SCORM2004 call does work with SCORM 2004 3rd edition and it is what Cornerstone have recommended to use.