Forum Discussion
Get preferred name rather than legal name from LMS using javascript
Hi Rebecca, try the following code:
var lmsAPI = parent;
var preferredName = lmsAPI.GetPreferredName();
var nameArray = preferredName.split(", ");
var firstName = nameArray[1];
var lastName = nameArray[0];
var player = GetPlayer();
player.SetVar('first_name', firstName);
player.SetVar('last_name', lastName);
Let me know if that worked for you!
- JoeFrancis2 years agoCommunity Member
Not sure what LMSAPI.js file you're looking at, but there is no such function as "GetPreferredName," as there is no counterpart in SCORM's data model. The only function related to the learner's name in LMSAPI.js is GetStudentName. This correlates to cmi.core.student_name in the SCORM 1.2 data model and cmi.learner_name in the SCORM 2004 data model.
Several years ago, Sam Colson documented the functions available in Storyline. That list can be found here.