Learner/user's name not displaying on the Certificate from LMS in SCORM 2004 4th Edition

I have added certificate in Storyline 3 and added below script in execute JavaScript window:

var player = GetPlayer();

var myName = lmsAPI.GetStudentName();

var array = myName.split(',');

var newName = array[1] + ' ' + array[0];

player.SetVar("newName", newName);

Also, made variable as "newName"

 

I have published the package as SCORM 2004 - 4th Edition as per client requirement.

But, the user/learner's name is not displaying on the certificate when it's view on cornerstone LMS. It is working fine in Cloud SCORM LMS.

Please advise for the same. 

 

Thanks,

Swapnil

3 Replies
Russell Killips

Try removing these two lines of code. They are for switching Lastname, Firstname to: Firstname Lastname

The switching may not be needed in your LMS.

var array = myName.split(',');

var newName = array[1] + ' ' + array[0];

Then change the player.SetVar line of code to:

player.SetVar(“newName”,myName);

Zsolt Olah

To troubleshoot add the following lines:

var player = GetPlayer();

console.log("lms",lmsAPI);

var myName = lmsAPI.GetStudentName();

console.log("myName", myName);

var array = myName.split(',');

console.log("namearray", array);

var newName = array[1] + ' ' + array[0];

player.SetVar("newName", newName);

 

When you run the code, open the console (on Chrome it's in Developer tools Ctrl+Shift+I). And see what the output is in the console. 

Here are the potential problems:

- if lms displays undefined, the whole lmsAPI is missing

- if myName displays an empty string or nothing than then you name is not returned from the lms

- if myName does not have a comma "Zsolt Olah" then you don't need the array part, you can just set the the SL variable newName to the myName

Or just take a screenshot and post it here :)