Pulling and trimming learner name in Storyline

Hey all,  looking to pull in the learners first name from our LMS into Storyline content - I found this thread, https://community.articulate.com/discussions/articulate-storyline/pulling-first-name-from-lms which works great :)  Almost....

Our LMS (SUccessFactors) pulls through the first name as "Firstname 1st intial 2nd initial" so for me as example it call me Jay J A...


Any clever javascript that can get rid of anything after the space after the first name?

8 Replies
Matthew Bibby

Sure, I can help.

Assuming you are starting with this code:

var lmsAPI = parent;
var name = lmsAPI.GetStudentName();
var nameArray = name.split(", ");
var firstName = nameArray[1];
var player = GetPlayer();

Simply update the fourth line so that it looks like this:

var firstName = nameArray[1].split(" ");

That should do the trick.