Send Custom variables to LMS

Feb 06, 2023

Hello,

     I have a complex project where I have created several custom variables to calculate the percentage learners receive after completing a simulation exercise. Essentially, I use a cumulative score which is added to or subtracted from for each right/wrong answer. At the end I calculate the percentage using the cumulative score divided by the maximum possible score. That is all calculated on a results slide. What I would like to do is send the calculated score (percentage) to the LMS to be reflected in the learner's gradebook. Currently, the value being sent, I believe, is Quiz.ScorePoints which is providing the wrong score. 

I have tried to use the Use a survey question option  (Articulate 360 - Storyline 360: How to Send the Value of a Variable to an LMS/LRS - Articulate Support) but for some reason I am unable to select my Percentage variable. See the attached. The Forum custom variable is the variables I have created for the project, the forum no variables is the available variables. I am not sure why I can't access the project variables. 

I cannot upload my actual file as it is commercial in confidence. Does it matter where the survey file goes. I would have thought as I don't do the calculations until the results slide, the survey slide would need to be after the results slide. Could this be the reason I cannot access my variables. 

Any help would be appreciated. 

Thanks Karen.

6 Replies
Jose Tansengco

Hi Karen, 

Thanks for reaching out! 

If you're following the survey slide method listed in this article: 

You'll need to place the survey slide before the Results Slide submits the data to the LMS in order for the value of the custom variable to be included.

Regarding why you are unable to select the custom variable when creating a trigger, we'll need to take a look at your project file to see how it is currently setup. If you'd be willing to share a copy of your project file by opening a support case, we can provide you with an NDA so you can share it with us in full confidentiality. We'll delete it afterwards. 

Karen Lumley

Hi Joe,

     I put in a support case but as I am looking at JavaScript they sent me back to the community to try and find a solution. I have run a number of tests and modified my JavaScript I don't know how many times. It looks like my JavaScript is not connecting to the LMS. I have tried two different LMS' as well. My main focus is to get my learner's final score ('Percentage') recorded in the gradebook but nothing I do seems to work. 

The code I am using is: 

var player = GetPlayer();

lmsAPI.SetScore(player.GetVar("Percentage"), 100, 0)'

lmsAPI.CommitData();

The other JavaScript was to see if I could retrieve the learner's name using a button as the trigger but that didn't work either which leads me to think that for some reason my JavaScript is either not executing which could mean I have the trigger in the wrong place, or my code is wrong. 

I am publishing as scorm 1.2 and the LMS is Moodle.

Luciana Piazza

Hi Karen,

Thanks for reaching out to us in a case and following up with us here in the community! 

I'm curious to hear what community members suggest with your JavaScript code. 

Since we don't provide JavaScript coding support, I wanted to pass along to anyone who comes across this thread an article on JavaScript Best Practices and Examples to get you started. 

Have a great start to your day!

Karen Lumley

Hey Russell,
thanks so much for this. That worked. I can't say how happy I am
because this has been plaguing me for a couple of weeks now. Thanks again.

*Thanks Karen*

Karen Lumley
IIT Training Pty Limited
[M] +61 498 728 181
[E] karen@iit-training.com
[W] www.iit-training.com

ISO9001:2015 Quality Endorsed
Registered Training Organisation, 90998

-----------------------------------------------------------------------------------------------------------------
IMPORTANT NOTICE - THE FINE PRINT

The information contained in this email and attachments (if any) is
intended only for the person or entity to which
it is addressed. The message may contain confidential and/or privileged
material. You should only disclose,
re-transmit, copy, distribute, act in reliance on or commercialise the
information if you are authorised to do so.

If you have received this in error, please contact the sender and delete
this email and associated material from any
computer. The IIT Training Group of companies does not represent, warrant
or guarantee that the integrity of this
communication has been maintained, nor that the communication is free of
errors, virus or interference.

------------------------------------------------------------------------------------------------------------------

Luciana Piazza

Hi Karen! 

Glad to hear that Russell was able to help you troubleshoot this with you!

Just wanted to pop in real quick. It looks like part of your email signature came through when you replied via email. You can remove that if needed by clicking ‘Edit’ beneath your response. Here’s a quick Peek video if you need help.

Have a great start to your week! ☀️