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?
- 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?
- 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. - NishaMakan-3a6fCommunity Member
Hi. I have a Storyline SCORM package embedded in an iframe on my LMS course page. I'm wanting to include the learners name in the Storyline file however the name is not showing up as the embedded course doesn't seem to talk to the LMS. I am getting a course saying it is unable to talk to the LMS API.
I tested the course by running it like a normal eLearning course which launches from the training course page in a new window - in this instance the names are appearing in the module, so I know the Execute Javascript code is working correctly.
Does anyone have any advice on how I could get this to work in my iframe version? The LMS I am using is Totara.
- k1967hHayesCommunity Member
This code is working for me on Totara - sadly I can't advise on it as I either found it within this thread or a previous discussion:
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);var lmsAPI = findLMSAPI(this);
var StudentID = lmsAPI.Getstudent_id();
player.SetVar("StudentID", StudentID); - k1967hHayesCommunity Member
Mr Bibby - you are simply a legend! Brilliant.
- GregMellang1Community Member
Matthew, your code works flawlessly in PeopleSoft Enterprise Learning Management (ELM).
A lot cleaner than what I used in Captivate for the past few years. Thanks so much for sharing.
- RyanKrugerCommunity Member
Any chance I can call on anyone to help me identify how I get similar functionality in Litmos LMS publishing as SCORM 1.2 - beyond the learner name, I'd like to collect another profile attribute as well... I'm using:
var player = GetPlayer();function findLMSAPI(win) {
if (win.hasOwnProperty("GetStudentID")) return win;
else if (win.parent == win) return null;
else return findLMSAPI(win.parent);
}
var lmsAPI = findLMSAPI(this);
var myName = lmsAPI.GetStudentName();
var array = myName.split(',');
var LMSName = array[1] + ' ' + array[0];
player.SetVar("name", LMSName);
This successfully writes the learner's first and last name to the eLearning displayed from Litmos.
What I'd like to get now is a custom field from the learner's profile in Litmos. According to our admin, this particular field is called "CustomField2".
- RyanKrugerCommunity Member
Sounds like this may need to be an http javascript call using our specific LMS' API. Has anyone tried this?
- JoeFrancisCommunity Member
Quite a while ago, Sam Coulson replied to a request surrounding retrieving data from an LMS. He included the list of variables LMSAPI.js includes. These are industry-standard variables and functions, originally used by AICC-compliant LMS' and courses.
IF your LMS exposes one or more of these variables to eLearning courses, you MAY get a response when you query the LMS through them and/or attempt to write data using them. As Sam says in his message, "this is advanced coder territory, reverse-engineer with caution."
Speaking from experience, I was able to Get and Set several status' from (oddly enough) an older LMS, which I was unable to then replicate on a newer LMS, including LanguagePreference, Audio, and SpeedPreference. Other functions and variables, including student demographic data, are non-existent, probably because they aren't key data points and each LMS treats them a little differently.
- CandiceBoult-b4Community Member
I know this is an old thread but I'm hoping someone can help me here. I'm very much a beginner.
I have used the code below (from earlier in this thread) and it works great. The student ID bit isn't working for me, it just shows on the LMS as 'undefined', which is fine because I don't want the ID, I only want the name but have no idea how to amend the code to remove the ID bit.
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);Any help would be really appreciated. Thanks :)