9 Replies
Matthew Bibby

Okay, are you using an LMS?

Because if so, I can show you how to bring the learners name into the course - without them having to type it in!

This will also take care of the double spaces and empty input fields issues.

If using an LMS, please let me know if you normally use SCORM 1.2, SCORM 2004 or xAPI.

Matthew Bibby

Okay, follow these steps:

  • Add a text variable to Storyline called Name
  • Go to View > Slide Master and add an Execute JavaScript trigger to the first master slide. It should look like this:

  • Then click on the Script button ... and paste the following code:
function findLMSAPI(win) {
if (win.hasOwnProperty("GetStudentID")) return win;
else if (win.parent == win) return null;
else return findLMSAPI(win.parent);
}

if (!window.nameFromLMS) {
var lmsAPI = findLMSAPI(this);
var name = lmsAPI.GetStudentName();
var nameArray = name.split(', ');
var firstName = nameArray[1];
var lastName = nameArray[0];
var fullName = firstName + ' ' + lastName;
var player = GetPlayer();
player.SetVar("Name", fullName);
window.nameFromLMS = true;
}
  • When this code runs, it'll grab the learners name from the LMS, reformat it and then store it in the variable we created earlier.
  • You can display the learner's name by adding the following reference to Storyline: %Name%

Here is a demo (via SCORM Cloud, you'll need to enter an email and name to proceed, but dummy values are fine).

Here is the .story file.

And here is the SCORM package which you can upload to your LMS to test that this will work in your environment. 

Hope that helps mate.