Retrieving Learner Name from Articulate Online via JavaScript?

Apr 11, 2014

I'm currently completing a course for a client (Flash-only) where I'm retrieving both the learner"s name and first name from the client's Saba LMS.  It works very well.

With thanks to both Steve Flowers and Phil Mayor, here's the JavaScript code that I'm using:

For learner full name (where varLearnerName is my variable for full name in the SL course and where Saba stores the learner name as Last Name, First Name):

var player = GetPlayer();
var myName  = lmsAPI.GetStudentName();
var array  = myName.split(',');
var newName = array[1] + '  ' + array[0];
player.SetVar("varLearnerName", newName);

For learner first name (I had to adapt the original code to delete a trailing space when the name was retrieved from the LMS, and where LearnerFN is my Storyline variable for first name):

var player = GetPlayer();
var rawName = lmsAPI.GetStudentName();
var nameArray = rawName.split(",");
var firstName = nameArray[1].replace(/^[ ]+|[ ]+$/g,'');
player.SetVar("LearnerFN", firstName);

However, this doesn't work when using the Guest Book and requiring learner's sign in first with a course in Articulate Online.

Anyone know how to do the same in AO with JavaScript?

5 Replies
rathna  kumaran

Hi All,

Background information:

Have designed a Completion Certificate slide within Storyline 2
I am having trouble with retrieving a user's name from the LMS and inserting it into a Storyline 2 course. I am using ABSORB LMS and building courses in SCORM 1.2
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("varLearnerName", newName);

Problem:

When retrieving the learner's name from the LMS in Storyline from ABSORB LMS with SCORM 1.2, I get the following: undefined firstname lastname

Any clue why/how "undefined" is showing up in the results?

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