Forum Discussion

PernilleReenber's avatar
PernilleReenber
Community Member
1 day ago

Expiration date for a course inside Storyline

Hi, Is it possible to set an expiration date for a course inside Storyline so that the SCORM package no longer works after a certain date?

4 Replies

  • You could use javascript to lock a course based on a date, it would be relatively simple to get around that but it is the only way I know how.

  • Nedim's avatar
    Nedim
    Community Member

    I’d recommend setting the expiration date through the LMS, as this allows the course to be completely inaccessible after a specified date, or to redirect learners to an internal page such as an expiration_notice.html.

    While this can be implemented in Storyline, it would require using JavaScript to define an expiration date and then, once that date is reached, display a layer or message indicating that the course content is locked due to expiration.

    I’ve attached a simple Story file that demonstrates this functionality. You can test it by adjusting the date values in the code to see how it behaves in your environment.

    const expirationDate = new Date('2026-06-12').getTime(); // set exp date
    const currentDate = new Date().getTime();
    
    const timeDifference = expirationDate - currentDate;
    
    if (timeDifference > 0) {
      
      const daysRemaining = Math.ceil(timeDifference / (1000 * 60 * 60 * 24));
      setVar('daysRemaining', daysRemaining); // storyline var
      
    } else {
      
      setVar('courseExpired', true); // storyline var
      
    }
    • PhilMayor's avatar
      PhilMayor
      Super Hero

      I read it that they wanted the scorm package to expire and then extrapolated that to mean they are selling licenses. If that is the case it maybe easier to manage using scorm dispatch on scorm cloud. If not use the LMS or the code Nedim supplied. 

  • Silverfire's avatar
    Silverfire
    Community Member

    Here's another vote for using the LMS to set the date. In this situation, I've always used the LMS, because if you needed to debug the course, or add things to it, or just to view it, you wouldn't want the JS telling you that you couldn't take it. You'd also limit the ability to show it off in your portfolio. Let the LMS do it.