Forum Discussion
Retrieve LMS User Name as Variable
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?
Thx
- PhilMayorSuper Hero
- RickForgeardCommunity Member
Hi Phil,
Realizing that this post is 4 years old....I was unable to open your SL file as it was made with an older version. I am running Storyline 2 Update 11. Can you save and post with a later version?
Thanks Rick
- WendyFarmerSuper Hero
Hi Rick
when you try to open the file it should give you the option to upgrade to SL2 - do you not see that pop up box?
- OgbishBarrowCommunity Member
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
- OgbishBarrowCommunity Member
Hi, okay I have downloaded this, please where do I insert it
- AndrewRostCommunity Member
Winner, winner, chicken dinner...Thanks, Phil! Very much appreciated.
- SteveFlowersCommunity Member
Hey, Andrew -
Should be able to grab the value through a JavaScript function. This won't work in HTML5 at the moment but should be fine in the Flash based version. Try this in a JavaScript trigger:
var player=GetPlayer();
player.SetVar("sLearnerName", SCORM_GetStudentName());
This'll grab the Student Name using the built in function in SCORMFunctions.js and push it into a variable called sLearnerName. If you need to arrange it differently you may need to split to an array and arrange the First / Last as separate parts before pushing in.
- OgbishBarrowCommunity Member
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
- JoshMasseyCommunity Member
Steve,
I doubt you pay any attention to this 7 years later - but I just had to say thanks! I have been racking my head against this keyboard for hours...all I needed was the SCORM_ component to work with the LMS we are using.
So excited!
- SteveFlowersCommunity Member
Haha, that's what I get for multi-tasking. Phil's example demonstrates it the rearrangement. lmsAPI.GetStudentName() and SCORM_GetStudentName() should return identical values.
var player = GetPlayer();
var myName = lmsAPI.GetStudentName();
var array = myName.split(',');
var newName = array[1] + ' ' + array[0];
player.SetVar("newName", newName);
- AndrewRostCommunity Member
You're correct, Steve. Works great in Flash, but epic failure in HTML5. Bummer...HTML5 is a deal breaker for my organization. Thanks to both for your quick replies.
- JørgenNielsenCommunity Member
lmsAPI.GetStudentName() is working for me, but SCORM_GetStudentName() is not - why?
I'm looking for a way to read/write values to lesson_location in SCORM 1.2, but lmsAPI does not offer a method for that. SCORM_CallLMSGetValue and SCORM_CallLMSSetValue in SCORMFunctions.js would be perfect, but how do I call them from my javascript? Do I need a src-statement?
- BrettRockwoodCommunity Member
Slightly off topic but I was wondering if you could use something similar to pull down a student's business unit or cost center. This would be really great in that you could then have the course automatically present the material that is applicable to a particular team.
I pretty limited in my LMS/SCORM knowledge; are there standard names like that that can be pulled down?
- SteveFlowersCommunity Member
Hey, Brett -
Unless someone's storing a value in the data model to bend in that type of info, this usually isn't exposed.
http://scorm.com/wp-content/assets/scorm_ref_poster/RusticiSCORMPoster.pdf
I agree with you, though. There are many pieces of information that I think could be carried forward from the LMS to customize / adapt to the needs of the user. I think things like accessibility preferences would be VERY useful.
- BrettRockwoodCommunity Member
Thanks Steve. Yes, accessibility would be excellent. I'm going to do some research and find out just what is available in the LMS we're using. I could imagine having language based on location and many other customizations.
- AndrewRostCommunity Member
An option if you have the ability to customize your LMS. We had our vendor code a second API that is initialized with the SCORM API that allows us to call a custom data set for exactly what you are looking for.