Forum Discussion
Pulling first name from LMS
Thanks Matthew and Lucio - this is working great :)
Except in one instance, when calling to display the last name, a random comma appears after it.
This is what I have used:
var lmsAPI = parent;var name = lmsAPI.GetStudentName();var id = lmsAPI.GetStudentID();var nameArray = str.split(" ");var firstName = nameArray[1];var firstInitial = firstName.charAt(0);var lastName = nameArray[0];var cleanLastName = lastName.replace(/[^a-zA-Z]/g, "");var userName = firstInitial + cleanLastName;var userName = userName.toLowerCase();var player = GetPlayer();player.SetVar('first_name', firstName);player.SetVar('last_name', lastName);player.SetVar('first_initial', firstInitial);player.SetVar('email', id);player.SetVar('username', userName);
This is how the reference appears on the slide:
Username: CORP\%first_name%.%last_name%
This is how it appears when published:
Username: CORP\Sal.Milford,
Surname is definitely just Milford in the LMS. Any ideas?
Thanks,
Sal
Related Content
- 7 days ago
- 7 months ago
- 3 years ago