Need your Help -Sending custom variable to LMS

Feb 02, 2022

Hi, 

I have a course with custom variable storing the score, 

Need to send the score to LMS. the limitations is that i can't convert the interaction to free form questions , as the scoring mechanism is complex spread over multiple layers within the slide. 

Java script option is possible 

is there a way to insert the custom variable value into the standard variable that storyline uses to report score to LMS ?

 

2 Replies
Judy Nollet

Hi, Aman,

I can't help with JavaScript, but I can offer a Storyline solution that might suit your needs: Put the value of the custom variable into the text-entry field of a How Many survey slide. You'll also need to include a Survey Results slide, because that's what will send the answer to the LMS. 

You could do this completely "behind the curtain," so the user doesn't know what's happening. For example:

  • Insert a How Many survey slide. 
    • Move the numeric-entry field off of the slide, or cover it with a shape so the user can't see it or click it. 
    • Add your interaction to the survey slide. 
    • At the end of the interaction, add a trigger that puts the score into the numeric-entry field. 
  • Add a Survey Results slide somewhere in the course.
    • This could also be disguised to look like just another slide in the course. 

This method would allow you to get the score. However, by itself, it doesn't control whether or not the user passes or fails. But you could use two completion triggers at the end:

  • Complete course as Completed/Passed, with the condition that the numeric-entry value is >= the passing score
  • Complete course as Incomplete/Failed, with the condition that the numeric-entry value is < the passing score

FYI: This post discusses the use of a disguised question slide and graded results, as a way to get completion in SL3. But it might have some helpful info for you:

https://community.articulate.com/discussions/articulate-storyline/tip-completion-in-storyline-3-without-quiz-questions-or-tracking-by-slides-viewed 

Joseph Francis

To return a learner's score to an LMS using JavaScript, you can do the following:

var player = GetPlayer();
function findLMSAPI(win) {
     if (win.hasOwnProperty("GetStudentID")) return win;
     else if (win.parent == win) return null;
     else return findLMSAPI(win.parent);
     }
var lmsAPI = findLMSAPI(this);

var userScore= player.GetVar("numUserScore");
lmsAPI.SetScore(userScore, 100, 0);

SetScore requires 3 parameters: the learner's score, the maximum-possible score (usually 100), and the minimum score (usually 0).

numUserScore is the numeric variable you create in Storyline to track the learner's score.