Forum Discussion
Getting student name from the LMS and using it in Articulate
Hi Matthew,
Thanks for the quick response. The script you gave me did not do the job, but the link to the discussion did. I am publishing to SCORM 1.2 and using HTML5 with Flash. This is what worked for me. Thanks everyone.
var player = GetPlayer();
function findLMSAPI(win) {
// look in this window
if (win.hasOwnProperty("GetStudentID")) return win;
// all done if no parent
else if (win.parent == win) return null;
// climb up to parent window & look there
else return findLMSAPI(win.parent);
}
var lmsAPI = findLMSAPI(this);
var myName = lmsAPI.GetStudentName();
var array = myName.split(',');
var newName = array[1] + ' ' + array[0];
player.SetVar("newName", newName);
Thanks,
Marcia
-----------------------------------------
The information contained in this email is confidential and is intended solely for the use of the person identified and intended as the recipient. If you are not the intended recipient, any disclosure, copying, distribution, or taking of any action in reliance on the contents is prohibited. If you receive this message in error, contact the sender immediately and delete it from your computer. Personal e-mails are restricted by PSECU policy. As such, PSECU specifically disclaims any responsibility or liability for any personal information or opinions of the author expressed in this email.
Publishing Using HTML5 on Cornerstone LMS, This code was sort of working but giving me a duplicated name...
By modifying it slightly I was able to get rid of the duplication and have the full name display.
I was hoping to separate the first and last name, but (after 22 attempts) I've decide to settle with it working this way.
The on-slide reference display variable is: %newName%
and the JS code was as follows:
var player = GetPlayer();
function findLMSAPI(win) {
// look in this window
if (win.hasOwnProperty("GetStudentID")) return win;
// all done if no parent
else if (win.parent == win) return null;
// climb up to parent window & look there
else return findLMSAPI(win.parent);
}
var lmsAPI = findLMSAPI(this);
var myName = lmsAPI.GetStudentName();
var array = myName.split(',');
var newName = array[0];
player.SetVar("newName", newName);
Thanks for the starting point!
- ThomasAlbrig8797 years agoCommunity Member
Do you have a sample course I could look at please? I found TRAINEE.FIRST.NAME and TRAINEE.LAST.NAME in our Email settings on CSOD but I am not sure how to make it work.