I know you can have a user fill in a text box with their name and then later use that variable for personalization. What we would like to do is programmatically retrieve the user name from the LMS. Is there a way to set a variable with data from the LMS when the course is loaded instead of having the user enter their name?
I was using the most recent code you posted previously (to me) on page 6 of this thread.
With 360 giving us the option for a preferred HTML5/Flash priority, how is this going to affect the choice of code we use? Could we encounter certain code not working depending on the format the course launches in?
Or would we need two triggers for the two different types of JS code? 1 for HTML5 and 1 for flash?
Hello , and thanks for this, Phil, but it seems like the file may have been corrupted, as all I see is pages of code. Can you please send an updated version via email to gbitse@gmail.com. Many thanks for your help
Hello please I need help on executing this. What is the simplest way to create a flow with this. E.g. Where do I insert the code, what should the next slide show and how do I create a display that will welcome the person
Hi all - I'm wondering if anyone might be able to put together a step-by-step guide as to how to set up a variable / javascript function for this? (i.e. pulling a user's first name from the LMS).
I've read through this discussion but I'm very green and have had no experience with javascript functions (and only basic variables).
Hey Sally! It looks like Matthew sent you a handy step-by-step guide in this thread. I wanted to share that link here for anyone else in the thread who wants to do the same thing!
Hello, I know this thread is old (5 years ago) but I'm hoping that someone can help me. I'm trying to print the name of users on a certificate of completion. The names should be their registered names for the course. I tried the codes but it's not working for me. Please help anyone..Thanks
The JavaScript trigger has to be executed before you use the name, that you stored in a variable. Since variables in Articulate hold there value for the whole project, you can put the JavaScript trigger on the first slide.
Hello, I'm not sure if I asked my question rightly. This is the scenario: Imagine a student logs in to his/her LMS and is going through this training course after which he/she will print out a certificate of completion that will include his/her registered name in d LMS. The module is created in Storyline 3. I have already created a certificate. How do I retrieve the name from the LMS to print on the certificate. Thanks for your help!
Kayode
Hello Kayode; Sorry, my english it's not very well. But what you can do is get the var from moodle with java script. I can't give you an example in storyline because what you need is a connection between the lMS and the story.html file.
However I will tell you step by step the procedure that I do to validate the username of the platform:
The activity you have to create is a URL module in the LMS and in the option of parameters you have to add the name. This will encrypt the LMS name variable to the URL.
In storyline you will create a variable named: %username%
Insert a trigger that executes this javascript:
function gup( name ) { name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); var regexS = "[\\&]"+name+"=([^]*)"; var regex = new RegExp( regexS ); var results = regex.exec( window.location.href ); if( results == null ) return ""; else return results[1]; }
var player = GetPlayer(); var sid = gup("username");
player.SetVar("username",sid);
The value of the encrypted variable already has it in the file story.html and is now a variable of storyline.
You can send that variable to a .html file where you have the certificate design. You can continue with this example for this step.
214 Replies
Thanks again Wendy and Leslie,
That did it. FYI, I triggered it on the timeline.
Rick
Great news Rick :)
This post was removed by the author
Hi Steve,
For some reason when publishing from 360 with HTML 5 and flash as a fallback, the code doesn't work anymore.
Anyone got any ideas?
Hi, James - Which code are you using? This works for me in HTML5 publish.
var player=GetPlayer();
lmsAPI=parent;
var username=lmsAPI.GetStudentName();
player.SetVar("SLVariable",username);
//alert(username);
Hi Steve,
Cheers for that, I'll give that one a go.
I was using the most recent code you posted previously (to me) on page 6 of this thread.
With 360 giving us the option for a preferred HTML5/Flash priority, how is this going to affect the choice of code we use? Could we encounter certain code not working depending on the format the course launches in?
Or would we need two triggers for the two different types of JS code? 1 for HTML5 and 1 for flash?
Nope. Since the JS executes in the client browser, shouldn't matter which packaging is used.
Thanks Steve, do you know why the codes just stop working?
As I said the code on page 6 worked for me on SL2, but not 360.
Hmm I cant get that code to work for me Steve, I'll try again tomorrow and let you know.
Thanks
James
Hello , and thanks for this, Phil, but it seems like the file may have been corrupted, as all I see is pages of code. Can you please send an updated version via email to gbitse@gmail.com. Many thanks for your help
Hi, okay I have downloaded this, please where do I insert it
Hello, please may I ask - is this the code for retrieving names from LMS? if so, where do I insert it. I am pretty new to Articulate
Hello Andrew, please can you tell me what exactly worked for you, and how I may go about using it. Is there a video?
Hello please I need help on executing this. What is the simplest way to create a flow with this. E.g. Where do I insert the code, what should the next slide show and how do I create a display that will welcome the person
Any resolution to this I can't get this working in 360 HTML5 output in any browser
-------------------
var player=GetPlayer();
lmsAPI=parent;
var username=lmsAPI.GetStudentName();
player.SetVar("SLVariable",username);
//alert(username);
----------------------
Anyone got this working?
Hi all - I'm wondering if anyone might be able to put together a step-by-step guide as to how to set up a variable / javascript function for this? (i.e. pulling a user's first name from the LMS).
I've read through this discussion but I'm very green and have had no experience with javascript functions (and only basic variables).
Any help for dummies would be amazing.
Thanks,
Sal
Hi Sally,
Which app are you using?
Hey Sally! It looks like Matthew sent you a handy step-by-step guide in this thread. I wanted to share that link here for anyone else in the thread who wants to do the same thing!
Hello, I know this thread is old (5 years ago) but I'm hoping that someone can help me. I'm trying to print the name of users on a certificate of completion. The names should be their registered names for the course. I tried the codes but it's not working for me. Please help anyone..Thanks
Hello Kayode!
There is a more recent thread here about this, that starts with code that works with current Articulate 3 in HTML5 and Flash output.
Thanks so much for popping in to share that thread with Kayode here Knut. Much appreciated and should get them in the right direction.
Hello for your prompt response. I have read the thread. Where should I copy the JavaScript? I mean on which slide? Thanks Kayode
The JavaScript trigger has to be executed before you use the name, that you stored in a variable. Since variables in Articulate hold there value for the whole project, you can put the JavaScript trigger on the first slide.
Hello, I'm not sure if I asked my question rightly. This is the scenario: Imagine a student logs in to his/her LMS and is going through this training course after which he/she will print out a certificate of completion that will include his/her registered name in d LMS. The module is created in Storyline 3. I have already created a certificate. How do I retrieve the name from the LMS to print on the certificate. Thanks for your help!
Kayode
Hello Kayode;
Sorry, my english it's not very well. But what you can do is get the var from moodle with java script. I can't give you an example in storyline because what you need is a connection between the lMS and the story.html file.
However I will tell you step by step the procedure that I do to validate the username of the platform:
function gup( name )
{
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\&]"+name+"=([^]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null )
return "";
else
return results[1];
}
var player = GetPlayer();
var sid = gup("username");
player.SetVar("username",sid);
I hope this helps you
Regards.
Eduardo