Manually invoke Store Suspend data on slide with JS

May 22, 2018


I'd like to add a trigger that saves the current state and data of a page to prohibit data loss when the user closes his browser or tab. 


When you exit a course, the progress of the current page is lost. For example: on page 3.2 you answer a question and then close your window. When revisiting you'll get asked to view the last visited page, but you have to answer the question again. It's SCORM 2004 4th edition. 

Specific for this course I am making, this is a problem. It uses a large dashboard with a lot of information. All this information has to be read in order to get point awarded as well as proper completion. So if you close this window, you got to reread everything. 

Solutions tried:

Execute JavaScript:


Execute JavaScript: 

//get LMS API
var lmsAPI = parent;

Execute JavaScript: 

//get LMS API
var lmsAPI = parent;
SCORM2004_CallSetValue("cmi.suspend_data", strData);

Execute JavaScript: 

//get LMS API
var lmsAPI = parent;
SCORM2004_CallStoreValue("cmi.suspend_data", strData);


Is there a way to manually invoke the course to store suspend data to you LMS? 


2 Replies
Joe Tansengco


You mentioned using the 'LMSCommit()' method. May I ask if you've tried to invoke LMS Commit on every slide using the Javascript triggers? This way, each slide triggers a commit to the LMS, making a record of your last viewed slide which can then be retrieved in the event that a user exits the course. I suggest to try adding the 'LMSCommit()' call as a JS trigger on timeline start and see if this work for you. 

While not a direct fix, you can also let your users know that the course attempt has not been saved in the event of any error using the method described here

You may refer to this discussion for a case that's similar to yours, and was resolved by triggering the 'LMSCommit()' function more frequently.

Hope this helps.




Jurg van der Vlies

Hi Joe, Thanks for your reply. 

Some extra details on the course. The dashboard shows 10 buttons, each opening a new slide layer. The slide layer needs to be closed by a cross. When the cross was clicked the JavaScript was executed. 

LMSCommit was properly executed as shown by this log from a test last friday: 

[15:45:42.788] SetValue('cmi.session_time', 'PT1M59.98S') returned 'true' in 0 seconds

[15:45:42.788] CheckForSetValueError (cmi.session_time, PT1M59.98S, cmi.session_time, , )

[15:45:42.788] Element is: session_time

[15:45:42.788] RunTimeApi_ValidTimeInterval

[15:45:42.788] Call is error free.

[15:45:42.788] StoreValue (cmi.session_time, PT1M59.98S, cmi.session_time, , )

[15:45:42.788] Element is: session_time

[15:45:42.788] Commit('') returned 'true' in 0 seconds

[15:45:42.788] Checking for Commit Error

[15:45:42.788] Call is error free.

[15:45:42.788] CompletedByMeasure is not enabled, using the completion status recorded by the SCO-incomplete

[15:45:42.788] Scaled Passing Score is not specified, using the success status recorded by the SCO-unknown

As you will see the Suspend data isn't triggered. Just time. 

This discussion is closed. You can start a new discussion or contact Articulate Support.