Forum Discussion

DianeWestern-0d's avatar
DianeWestern-0d
Community Member
11 days ago

SL: JavaScript to send Numerical score to LMS (Scorm 1.2)

Hi,

Looking for clear cut example of sending a quiz score to an LMS; the LMS can only handle SCORM 1.2.   (eFront)

  • I've been trying JavaScript.

  • (And yes, have read that some LMS systems cannot display the score without an API onboard. I am testing & just trying to get correct code, and go from there.)

  • Have read dozens of posts that contain partial snippets of answers; have tried many of the JavaScript solutions, but unable to figure this out.

  • Have read that the SL generated variable (Quiz1.ScorePoints) cannot be directly sent to the LMS, but rather, should be moved to a newly created variable.  Will be working on that next.  The example posted was not easy for me to understand, so if that is the best solution, would appreciate a simple example for a rookie.

  • In addition, I believe I need the publish settings, too; not sure yet, but seems to me -- that those settings must be set in a specific way, or even though the JS is correct, the settings will prevent the score from being sent to LMS.  So, this endeavor seems to be further complicated by not knowing which settings will send a numerical score, such as Quiz1.ScorePoints -- to the LMS - if JS is correct.  

  • Very rusty w/JavaScript (due to many years of not using former beginner skills).

  • (One post indicates this is not possible (send point score to a SCORM 1.2 LMS, and that we should use a Short Survey question as a workaround and move the variable over that way;) however, ShortSurveys seem to use Text-based variables, and I need to use a numerical field to move the variable to the LMS.)

  • (Unable to view CONSOLE while testing - another caveat that makes this tricky.)

Anyway, if someone could point me to a post with a code snippet, that would be helpful. 

Thank you very much!

  • Hi DianeWestern-0d

    If you are just looking to send the quiz score to the LMS you shouldn't need to get your hands dirty with JS. If you have a quiz in your module, and the quiz questions are processed by a results slide, the SCORE will be sent to the LMS. Ensure the SCORM 1.2 publish settings are set to "When the learner completes a quiz" under the Tracking tab.

    Here's a quick video demo:https://app.screencast.com/dZY1HKfV40p0o

    And the demo Storyline file attached at the bottom of this post.

    If you are looking to send the quiz points to the LMS, this is not supported by SCORM 1.2, as the score field will only accept a number between 0-100. This is why most LMS will display the number with the "%" symbol, as it is expected the score is a percentage.

    If your "points" happen to fall between 0-100 and will not go over 100, then, technically, you can do it, but understand that you are not using the field correctly, and could experience issues using this method as some other functionalities sometimes depend on that score, for example mastery_score.

    Here's the technically possible way to do it using JavaScript (use at your own risk, i.e test it lots!):

    Firstly, you need to assign the quiz score, for example "Quiz1.ScorePoints", to a new user defined "Number" variable in Storyline. We'll use "quizScore". This would be done on the results slide for example:

    Then the JavaScript, you can run this "When the timeline starts" too, directly after the trigger above.

    // Set the score
    const player = GetPlayer();
    const quizScore = player.GetVar('quizScore');
    SCORM_CallLMSSetValue("cmi.core.score.raw", quizScore);

    You would need to ensure that the you also manage the completion of the course yourself, and ensure you do not publish using a results slide to track completion, or this will overwrite the score you set with JavaScript. 

    Here's a video of this result (the LMS is automatically displaying "%"): https://app.screencast.com/q2szkMJbrpZiy

    • DianeWestern-0d's avatar
      DianeWestern-0d
      Community Member

      Thank you everyone.  Planning to get back on this within a week!  Truly appreciate everyone's help! 

  • Thank you for explaining the difference of score vs points (which is very helpful). I think I can make them equal via weighting.

    (What we're doing will eventually be 4 levels/branches (adaptive); but if can get just one piece to score in LMS, at least we'll know what we are dealing with.

    Thank you so much!  Your explanations are very clear...appreciate your time. 

  • Nedim's avatar
    Nedim
    Community Member

    (One post indicates this is not possible (send point score to a SCORM 1.2 LMS, and that we should use a Short Survey question as a workaround and move the variable over that way;) however, ShortSurveys seem to use Text-based variables, and I need to use a numerical field to move the variable to the LMS.)

    That's correct. But you could use a "Pick Many" Survey Question, which can store a numerical value and send it to the LMS. To repurpose it, set its variable equal to the "Quiz1.ScorePercent" built-in variable when the timeline starts on the Result slide.

    On the Result slide, reference the survey question's variable instead of directly using the "Quiz1.ScorePercent" variable. Publish it as "Passed/Incomplete" when the learner completes a quiz. 

    • DianeWestern-0d's avatar
      DianeWestern-0d
      Community Member

      Thank you so much!  Appreciate your time, help, and expertise.  (Hoping to get back on this later today.)

  • Sam, Thank you for taking so much time to create/explain this.  (Will dig into publish settings in morning as I think that is where the issue resides.)  Thank you!