Forum Discussion
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...
Jürgen_Schoene_
2 years agoCommunity Member
on Scorm Cloud you get with "lmsAPI.GetStudentName()" for the learner "John Doe"
- Scorm 1.2: "John Doe" (cmi.core.student_name*)
- Scorm 2004: "D, J" (cmi.learner_name**)
for Scorm 2004 (on Scorm Cloud) your script should be the result
- firstName = "J"
- lastName = "D"
for Scorm 1.2 (on Scorm Cloud) you can change your Javascript
var nameArray = name.split(", ");
var firstName = nameArray[1];
var lastName = nameArray[0];
to
var nameArray = name.split(" ");
var firstName = nameArray[0];
var lastName = nameArray[1];
- firstName = "John"
- lastName = "Doe"
you should check your LMS whether it behaves in the same way, there seems no definition in Scorm how a name is formated
* format "CMIString (SPM: 255)"
** format "localized_string_type (SPM: 250), RO)"