Forum Discussion
Getting student name from the LMS and using it in Articulate
In the LMS we are about to use, we can get the student name since the SCORM runtime variable for it is "cmi.core.student_name". However, how do I get it as a variable in Articulate at run time?
40 Replies
- asmaahamedCommunity Member
Thanks for sharing this, it was really helpful thread!
I got an issue when applying this on IE11, it seems to be only working if the publishing was flash with HTML, yet it's not working in the HTML5 format?
Hi Azza,
Are you having an issue with the code that Aaron shared?
It looks like he used it with HTML5, but perhaps it's the difference in browser or LMS. You could also look at testing it in SCORM Cloud to further narrow down where the issue could be.
Lastly, when you're launching it in IE - do you see an error message or a different behavior than expected? If you can share a bit more detail that may be just the hint the community needs to help with this custom code.
Thanks, Claudius for letting us know that this same code works in your LMS. I'm certain that tidbit will be welcomed by other SABA users.
- ThomasAlbrig879Community Member
I tried this in CSOD with Storyline 360 but it didn't work. Do you have a working sample that I could use to troubleshoot the functionality?
Thanks!!!
- MarciaDoughertyCommunity Member
- KevinHayesCommunity Member
I've been trying to use this code on SCORM Cloud but it isn't working for me:
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);Is it because SCORM cloud stores the name under a variable name other than StudentID?
Has anyone managed to get this to retrieve the learner ID from SCORM cloud?
- AlexandreCar143Community Member
This file did works on our LMS but I always get an "undefined" before my name.. at this point what should I look to hide this?
- nathanleavittCommunity Member
The lmsAPI.GetStudentName(); method no longer works for me when I publish to HTML5 only. Here's the code that I use for HTML5:
//This trigger is set to execute when the timeline starts. In order for it to work, this slide requires a variable "newName".
//Get User Name embedded into file from LMS
var myName = SCORM_GetStudentName();//SCORM has last name, first and we are switching it around to first last.
var array = myName.split(',');
var newName = array[1] + ' ' + array[0];//Set the variable
var player = GetPlayer();
player.SetVar("newName", newName);FYI, we’ve found that although the lms.js file is still included in the published HTML5 zip package, it’s not actually used and all its functions and variables aren’t used in our LMS. I’m not sure if that has something to do with our LMS (Saba Cloud) or something else. Regardless, that’s why the lmsAPI variable is undefined in our LMS. Instead I used the SCORM_GetStudentName(); function from SCORMFunctions.js.
- SueAshbyCommunity Member
Thank you so much for this. Even though this was published so long ago, it helped me this morning when my js snippet stopped working. For some reason var myName = lmsAPI.GetStudentName(); was working in my Storyline file for quite some time and then stopped. I suspect that Moodle was updated or something. Anyway. I changed lmsAPI to SCORM_ and now it works and retrieves the student's first name. I am eternally grateful!
- GinaLabato-d156Community Member
Hi all, revisiting this post.
My team and I are trying to do the following using JavaScript:1. Retrieve a username from the LMS
2. Culminate user's score on a quiz into a LeaderBoard.
For now, we're trying to tackle the first problem and have realized that all of the codes provided in these threads do not work with Docebo LMS for some reason. Any suggestions?
None of us are versed enough in Javascript to know how to manipulate the code for our LMS more than just plug it in and test.
Related Content
- 8 months ago
- 8 months ago