Forum Discussion

ChristophSchmol's avatar
ChristophSchmol
Community Member
22 days ago

Checking course completion with the LMS

When a Storyline training starts, can I check with the LMS to see if the quiz has already been passed? We have updated a course and need to check whether the trainees are returning or new users.

7 Replies

  • Hi ChristophSchmol​,

    That’s a great question!

    A quick note on how this behaves, Storyline can send completion, success, and quiz result data to an LMS through SCORM, xAPI, cmi5, and similar standards. However, there isn’t currently a built-in Storyline trigger or condition that can directly check whether a learner previously passed a quiz in the LMS when the course launches.

    In many cases, returning learner behavior depends more on how the LMS handles resume data, completion status, and suspend data for the published course.

    If you need to distinguish between new and returning learners based on prior completion status, that may be possible through custom JavaScript interacting with the LMS API, though the exact approach would depend heavily on the LMS and reporting standard being used.

    One thing to keep in mind is that updating and republishing an existing course can also affect how some LMSs treat prior completion data, so behavior can vary quite a bit between platforms.

    • ChristophSchmol's avatar
      ChristophSchmol
      Community Member

      Hi Eric, thank you for clarifying that it is still not possible to retrieve a previously sent “success” status from the LMS using Storyline.

      Could you point me to a guide on how to create a query like that using JavaScript for SCORM 2004 projects?

      Thank you!

      • AndrewBlemings-'s avatar
        AndrewBlemings-
        Community Member

        Let me know if you find something different at any point, but I've looked into this a bit over the years and haven't found much in the how-to department. The good news is that all of the available JavaScript functions we would use to communicate with an LMS are already packaged with Storyline and very easy to call.

        To find the list along with the contents of each function and a fair amount of settings, simply publish a course to your local drive, open the file folder, and navigate to the /lms folder, inside of which will be a very large scormdriver.js file. It can be a lot to browse through, and you may prefer an online manual to learn more about things, but you'll probably want a SCORM2004_GetStatus() function. It can be called in an Execute JavaScript trigger in Storyline like:

        let status = window.top.SCORM2004_GetStatus();

        I have not personally used it (yet) but I have used the SCORM2004_GetStudentName() function with great success a number of times. You'll need to test the course in an LMS or its testing environment of course, but if you're familiar with JavaScript then using that returned value elsewhere in the course should be simple.

        If you want to get more granular, there is also a SCORM2004_GetScore() function, though again I've never used it. Someday soon I hope.

  • Status or lesson status should work. But Andrew has already given you that. 

  • Hi Andrew and Phil,

    I asked AI how I could implement the LMS query using JavaScript. Attached is the suggested code for SCORM 2004. (The variable named “BB” in line 36, which I use for the true/false query in Storyline, had already been in my project but was unused.)

    I tested the script with our training course in Reach 360 and it actually worked. After completing the quiz, "BB" changed from false to true.

    What do you think of the code?

    (function () {
    
        // --- SCORM 2004 API discovery ---
        function getAPI(win) {
            var maxTries = 500;
            while (win && maxTries--) {
                if (win.API_1484_11) {
                    return win.API_1484_11;
                }
                win = win.parent;
            }
            return null;
        }
    
        var api = getAPI(window);
    
        if (!api) {
            console.log("SCORM 2004 API not found");
            return;
        }
    
        // --- Read SCORM status ---
        var completionStatus = api.GetValue("cmi.completion_status");
        var successStatus    = api.GetValue("cmi.success_status");
    
        console.log("Completion:", completionStatus);
        console.log("Success:", successStatus);
    
        // --- Decision logic ---
        if (
            completionStatus === "completed" ||
            successStatus === "passed"
        ) {
            // Storyline bridge
            var player = GetPlayer();
            player.SetVar("BB", true);
        }
    
    })();

     

  • A follow-up question on this:

    Is there a way to use Storyline's built-in tools or JavaScript to check whether all entries in a restricted TOC have been unlocked? This could serve as an alternative to checking the completion status in the LMS.

    Thank you!

    • AndrewBlemings-'s avatar
      AndrewBlemings-
      Community Member

      Separate from LMSs and JavaScript, it's simple to create triggers on a slide that toggle a variable to true when a TOC button has been clicked. Each button can have a variable, and in theory yes, those can be checked when a TOC slide is visited, and then additional triggers can update the content to reflect those variables, including setting buttons to show as visited.

      The challenge we return to is how to get that information into the Storyline course. Since we use web technologies, you're able to save someone's progress to their browser's local storage/cache and then artfully load it when the course loads, but that's not a perfect method.

      The variables and their states can be sent to many LMSs, saved there, and then retrieved by the course the next time it's opened, but there seems to be much less documentation of people doing that. I've never done it myself, not having admin access to any of the LMSs I've worked on.

      There are for instance SCORM2004_GetDataChunk() and SCORM2004_SetDataChunk(strData) functions in that scormdriver.js file I mentioned, but not every LMS stores every kind of information, and maybe those are more helper functions? What's to stop me from sending more than one data chunk? If I send more than one, does the second overwrite the first? If they don't overwrite, how does GetDataChunk() know which one to return?

      I wish there were more concrete answers to these things since I see it as enabling a lot of amazing eLearning, but I expect you'll need to lean on the LLM you've already tapped into.