Forum Discussion
Pulling first name from LMS
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 (https://community.articulate.com/discussions/articulate-storyline/retrieve-lms-user-name-as-variable) 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
- ChrisPim-7dc640Community Member
Yes as Leslie says. JavaScript is enabled. It's a definite problem with the script, 360 and Moodle. In storyline 2 the same script works properly.
- LucioCommunity Member
I'm still on SL2 and will be for a while. Sorry I can't help!!
- JamesBonney-EDECommunity Member
Hi All,
The original code posted by Matthew works in Flash/HTML5 fallback, but not with HTML5/Flash fallback:
var lmsAPI = parent;
var name = lmsAPI.GetStudentName();
var nameArray = name.split(", ");
var firstName = nameArray[1];
var player = GetPlayer();
player.SetVar('first_name',firstName);Any idea on how to get this working with HTML5/flash fallback?
Thanks
james
- LeslieFosterCommunity Member
James, thanks for adding to the debate. I have the same issue as you (noted above). I have confirmed that it is not a moodle issue as I have tested on more than one LMS.
- JamesBonney-EDECommunity Member
Thanks Matthew & Chris.
I tried the code posted by Chris/linked to by yourself and works a treat! Thank you.
- ilanaDuboviCommunity Member
Hi all,
I've read through this discussion.
Can you please help me to set up an execute javascript for transmitting score from HTML5 to moodle.
I've been using for Flash the following code, but seems that is not working with HTML5 publishing only:
/*Get player to reference*/
var player = GetPlayer();/*get LMS API*/
var lmsAPI = parent;
/*set score; the first number is the score*/
lmsAPI.SetScore(player.GetVar("zScores"), 100, 0);
/*set status; possible values: "completed","incomplete", "failed", "passed"*/
With thanks,Ilana
- JohnBrindleCommunity Member
I've managed to post a solution that Frankenstein's all of these and tests for html5 over on this thread .
I've taken some stuff from Matthew's solution and some stuff from others. this has been tested in HTML5, Flash and in Moodle.
Thanks for sharing John - looks like some good conversation happened in that thread as well :)
- valentinosan598Community Member
Hi all, is there a way to omit the middle name? Our LMS (SuccessFactors) has separate fields for First, Middle and Last name, but the script is pulling the first+middle.
- JackieB2013Community Member
I know it's been a long time, but did you ever find a solution for this? Exact issue I'm having now.
- JackieB2013Community Member
Thanks so much for this code! It's still very useful 6 years later! Any idea why it would be pulling first AND middle names from the LMS (SuccessFactors)?
- PhilLakCommunity Member
Hi Mattews,
You seem to be the one who could fix my problem.
On a french LMS, names have accentuated letters ( ie : é). What is retrieved is a "é" instead of an "é".
What would be the piece of code to transform that ?
Thank you for your help.
Have a nice day
Philippe