HELP! SCORM 2004 v3 and Javascript

Jun 24, 2016

Hi everyone.

I am having an issue (either Cornerstone, CSOD LMS, or the javascript) where I can't retrieve the users name from the LMS.

I have created a trigger on the first slide of my SL2 course with the js that communicates with CSOD to retrieve the name and places this in a variable.

It works perfectly in SCORM 1.2 but the javascript doesn't work in SCORM 2004 v3.  I am not really sure what the problem can be.  Do I need a different script syntax when using SCORM 2004?  

I need to publish in 2004 because I am trying to report on the assessments that I've created in SL2.  I need to know how many people are getting a question right/wrong.  TinCan isn't an option for me because Cornerstone wants to charge extra $$ for us to use the API.  (not sure if this was a contract item, but beyond my control)

Any help is greatly appreciated.  The syntax below is the JS being successfully used in SCORM 1.2.  I believe this code came from someone on the boards or elsewhere - I apologize that I don't recall the name to give credit.

//grab the LMS object
var lmsAPI = parent
//ask the LMS object to get the name
var rawName = lmsAPI.GetStudentName();
//the name comes very formal "Last, First"
//we will fix that by sticking the name into an array
var nameArray = rawName.split(",")
//get the first name
var firstName = nameArray[1];
//get the last name
var lastName = nameArray[0];
//now we grab the Articulate player
var p = GetPlayer();
//finally we set our Articulate vars to our js values
p.SetVar("firstname",firstName);
p.SetVar("lastname",lastName);

 

THANK YOU SO MUCH FOR HELPING!!

10 Replies
Walt Gill

Good morning Kamil.

Thanks so much for your help.  I made the change to the javascript as you suggested but unfortunately, I am still getting 'null' as my name.  I am posting the new code as well.  When I've published to the LMS and take the course, it will not post the learners name.

//grab the LMS object
var lmsAPI = parent
//ask the LMS object to get the name
var rawName = lmsAPI.SCORM2004_GetStudentName();
//the name comes very formal "Last, First"
//we will fix that by sticking the name into an array
var nameArray = rawName.split(",")
//get the first name
var firstName = nameArray[1];
//get the last name
var lastName = nameArray[0];
//now we grab the Articulate player
var p = GetPlayer();
//finally we set our Articulate vars to our js values
p.SetVar("firstname",firstName);
p.SetVar("lastname",lastName);

 

Any other suggestions will be so much appreciated.

Thank you!

Walt

This discussion is closed. You can start a new discussion or contact Articulate Support.