How Can I Display a User's Name in a SCORM Activity?
Question
I have a SCORM activity and I'd like to display the name of the user viewing it. Is it possible?
Answer
When a SCORM package is viewed by a user, the package may be able to display the user's name as it is entered in the learning environment. In order to accomplish this, you need to use the JavaScript similar to the following:
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 player = GetPlayer();
var myName = lmsAPI.GetStudentName();
var array = myName.split(',');
var last = array[0];
var first = array[1];
first = first.substring(1);
var firstChar = first.charAt(0);
var lastChar = last.charAt(0);
var fandl = firstChar.concat(lastChar);
var fullname = first.concat(" ",last);
player.SetVar("Name", fullname);
player.SetVar("Initials",fandl);
player.SetVar("Firstname",first);
How you insert this JavaScript in your SCORM authoring tool depends on the tool itself. This JavaScript also references variables, which may be named differently in your SCORM file. It's important to note that while Dual Code provides support for its learning environment, we do not provide technical support for writing JavaScript nor do we support 3rd party SCORM authoring tools (e.g. Adobe Captivate, Articulate Storyline, etc.).
You can download a sample SCORM package here and deploy it to your Dual Code learning environment. If this file displays the name of the user who is logged in, it means your learning environment works as expected. If the Dual Code file does not work, you may contact our Help Desk for assistance. If the file downloaded from this web page works but the SCORM file you created yourself does not work, then the problem most likely is with the JavaScript in your file. It's important to note that while Dual Code provides support for its learning environment, we do not provide technical support for 3rd party SCORM authoring tools (e.g. Adobe Captivate, Articulate Storyline, etc.). If your SCORM package does not work, please contact the these companies (e.g. Adobe, Articulate, etc.). Otherwise, you may enter into an agreement with our Implementation Services team who can help you design and develop your courses for a fee.