Storyline 3 Get lmsAPI.GetStudentName

Aug 21, 2017

Hi,

 

In Articulate Storyline 3, its the same code of SL2 to get a Student Name?

Because i put the code and SL3 don´t give me a User Name.

"

var player = GetPlayer();

var myName = lmsAPI.GetStudentName();

var array = myName.split(',');
var userName = array[1] + ' ' + array[0];

player.SetVar("userName", userName);

//myName = player.GetVar('myName');

//player.SetVar("newName", newName);

"

8 Replies
Ashley Terwilliger-Pollard

Hi Luis, 

The Javascript documentation here for Storyline 3 includes a few examples that you could use, although they're not something we'd offer support for. 

There were some variables thats users had accessed in Storyline 2 (without Articulate documentation) that aren't working in Storyline 3 or 360 based on the changes we've made to our published output. If you'd like our team to confirm that you're running into one of those scenarios, we can take a look at your .story file if you'll upload it to our Support Engineers at this link.

Tristan Hunt

Here is the code I used for Moodle. It may differ to what you need for your LMS.

 

function findLMSAPI(win) {
if (win.hasOwnProperty("GetStudentID")) return win;
else if (win.parent == win) return null;
else return findLMSAPI(win.parent);
}
var lmsAPI = findLMSAPI(this);
var player = GetPlayer();
var myName = lmsAPI.GetStudentName();
var array = myName.split(',');
var last = array[0];
var first = array[1];
first = first.substring(1);
var firstChar = first.charAt(0);
var lastChar = last.charAt(0);
var fandl = firstChar.concat(lastChar);
var fullname = first.concat(" ",last);
player.SetVar("Name", fullname);
player.SetVar("Initials",fandl);
player.SetVar("Firstname",first);

 

 

 

 

 

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