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?
Matthew, I don't know if you have any other suggestions. I have been trying to get the JavaScript trigger to work using the script you provided, but with no luck. When I run it live in the LMS I am not getting an error, just nothing is being returned. Not sure what I am missing. Would it matter if I am using a demo version of 360? Are some features disabled?
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.
This JS is already giving me a headache. This might be a very simple fix for someone. All I need is to pull a student's name from Blackboard and insert it in a completion certificate slide that I have created. Please see the attached certificate with the script I'm using (created by Matthew Bibby). I am using Storyline 3. Any help will be greatly appreciated.
Would you know why the print function is not working? When I try to print the certificate I receive the error message "There was an internal error, and IE is unable to print this document"
Can you let me know how to add the trigger to have the certificate run when time timeline starts. I would like the certificate to add the first and last
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 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?
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.
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.
Hopefully, the users you are reaching out to for examples are still subscribed here. If you do not hear back soon, you can reach out to Matthew and Aaron directly.
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.
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.
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.
40 Replies
Create a javascript trigger and use some code like this:
Let us know if you need more help than this. There is more sample code here: https://articulate.com/support/article/javascript-best-practices-and-examples
Thanks so much. I think that will do it for me. Much appreciated.
Excellent Matthew. I should have refreshed the page before replying. I've use parts of your demos in my work. Keep up the great work!
Thanks Matthew. I appreciate the help.
Matthew, I don't know if you have any other suggestions. I have been trying to get the JavaScript trigger to work using the script you provided, but with no luck. When I run it live in the LMS I am not getting an error, just nothing is being returned. Not sure what I am missing. Would it matter if I am using a demo version of 360? Are some features disabled?
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.
This JS is already giving me a headache. This might be a very simple fix for someone. All I need is to pull a student's name from Blackboard and insert it in a completion certificate slide that I have created. Please see the attached certificate with the script I'm using (created by Matthew Bibby). I am using Storyline 3. Any help will be greatly appreciated.
Hey Matthew,
You are my HERO! I can't thank you enough.
Would you know why the print function is not working? When I try to print the certificate I receive the error message "There was an internal error, and IE is unable to print this document"
Hi Matthew,
Can you let me know how to add the trigger to have the certificate run when time timeline starts. I would like the certificate to add the first and last
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!
Thanks for sharing with everyone Aaron.
Welcome to E-Learning Heroes :)
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.
works also in SABA Cloud
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.
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!!!
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.
Hey Thomas,
Hopefully, the users you are reaching out to for examples are still subscribed here. If you do not hear back soon, you can reach out to Matthew and Aaron directly.
This attached script worked for me.
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?
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?
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.
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.
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.