Retrieving name variable from LMS works with scorm export, not with xapi - why?

Jun 14, 2022

Hi everyone!

we want to retrieve the user name from our LMS in storyline-trainings using the following code:

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.GetStudentName();
var array = myName.split(',');
var newName = array[1] + ' ' + array[0];
player.SetVar("name", newName);

 

 

This works perfctely fine with Scorm exports, not so with xAPI. Does anyone know what the problem might be?

Cheers

Patrick

1 Reply