RebeccaEvens-af
2 years agoCommunity Member
Get preferred name rather than legal name from LMS using javascript
Does anyone know how to edit this javascript to pull a learner's preferred name from the LMS rather than the legal 'first name' field? Learners who have changed their gender and their preferred name, but not their legal name, are still seeing their old name in our courses. All our other systems use the 'preferred name' field.
var lmsAPI = parent;
var name = lmsAPI.GetStudentName();
var nameArray = name.split(", ");
var firstName = nameArray[1];
var lastName = nameArray[0];
var player = GetPlayer();
player.SetVar('first_name',firstName);
player.SetVar('last_name',lastName);