Can't set values in the LMS

I am new to Lectora and am currently experiencing two issues in regards to LMS communications.

I've been making custom eLearning for over 20 years and am used to being able to store whatever data that I need or want in the SCORM/AICC variables for location and suspend data. As I understand it, Lectora uses the location variable to store the last page visited. When it comes to suspend data, the documentation I have found states the following:

AICC_Core_Lesson - This variable contains information used by the published title to properly calculate the score of the user in the current title. If you modify the value of this variable within the content of a title that contains more than one automatically graded test, then the AICC_Score of the student cannot be properly updated and reflected to the AICC/SCORM Learning Management System (LMS). For all versions of SCORM including SCORM 2004, this variable is typically referred to by your LMS as cmi.suspend_data."

If this is accurate and still applicable, I interpret this to mean that Lectora only uses this variable if you have a course with multiple tests and it needs to do so as SCORM / AICC only has one variable to store the lesson score and therefore Lectora needs to store multiple test scores somewhere else so it can then calculate the overall score and store that in the single SCORM / AICC variable reserved for that. Although this is warning us that if we use that variable it will break things in muli-test courses it does say that we can write to it and use it.

I created a small test package that has the minimum amount of things Lectora requires to make a SCORM package. It contains two pages. The second page is an exit page that issues onShowExitClose. The first page contains the following onShowRunJS code:

var suspendData, suspendDataString;

if (AICC_Core_Lesson.getValue())
suspendData = AICC_Core_Lesson.getValue();
suspendData = {
page: 'abc123',
mod: 'two',
pi: 0
suspendDataString = JSON.stringify(suspendData);


The first time that I run this package, AICC_Core_Lesson is null, AICC_Lesson_Status is "incomplete" and AICC_Score is null. When I close the course and reopen, AICC_Core_Lesson and AICC_Lesson_Status are "incomplete" and AICC_Score is 100. So the above code works only for AICC_Score.

1. Can I use AICC_Core_Lesson to store custom data? If so, how do I do that and how do I keep Lectora from overwriting it? Also, why is Lectora storing the value, "incomplete" there when the documentation says that it only stores scores there if the course has multiple tests?

The other issue is every time I launch the course an alert pops up that declares that VarAICC_Lesson_Status is not defined. I have read on the forums that Lectora does not create a variable until it is actually used? I don't understand why it would do that? When I go to the Variable Manager and create a variable, I am defining it by definition. These variables should be available at all times within the course. In this specific case, we are talking about a variable that Lectora defined, not me - it's a reserved variable! And yet I'm being told it's undefined?

I have found that if I put a text box on the stage and reference variables inside of it, that takes care of this issue in most cases. However I have that text box on the first page of this project and I'm still being told that it's undefined. The text box shows the variable's values and after the first the launch they are all showing values.

2. Why is VarAICC_Lesson_Status popping an alert that it is undefined when the text box shows that it exists and contains a value?

Thank you for your time and help!


  • wheels
    wheels Community Member, Administrator, Moderator, Rockstar Manager Posts: 702 eLearning ROCKSTAR Admin Team

    Generally if you want to store something you should store it in a Lectora User defined variable by using a Modify Variable action. If the user variable you create is set to retain the variable value between sessions we'll save it for you.

    The AICC prefixed variables do not start with Var, they are just referenced like AICC_Lesson_Status.set() although you shouldn't need to set it this way. Instead try the Modify Variable action.

    Here is a little more information on how we map variables to the SCORM specification:
  • fyoda-3494
    fyoda-3494 Community Member Posts: 2
    Thank you for your response.

    Removing "Var" from the AICC_Lesson_Status fixed that problem. No more alerts and Scorm Cloud reflects my setting it to completed. You stated a couple of times that I "shouldn't have to" do it that way (using js) and that I should just use the Lectora built in stuff. Writing and editing code in javascript is my preference as long as it works - less objects that one has to add to the Lectora flow chart (or whatever you all call it).

    You did not answer my first question however, on whether or not I can use AICC_Core_Lesson to store what I want to store. Again, you said that I "should use" another method but did you not come out and say that I cannot use it. I've seen documentation that says that I can. But it doesn't work so far.

    Concerning your suggestion that I store whatever I want in Lectora user defined variables and make sure they are checked "save between sessions" and Lectora will "save them for me" in the LMS. I just tested that.

    It appears to save my variable but where is it saving it to? I checked the LMS data on Scorm Cloud and I cannot find my variable info there. Is it saving this data via cookies? If so what if the user has cookies disabled?

    Thank you.
  • carlfink
    carlfink Community Member Posts: 1,099 ✭ Legend ✭
    @fyoda.3494, consider that if you use AICC variables, to a certain extent you are depending on your LMS implementing that a certain way. What happens if your course is then run on a different LMS?
  • wheels
    wheels Community Member, Administrator, Moderator, Rockstar Manager Posts: 702 eLearning ROCKSTAR Admin Team
    Hi @fyoda.3494

    Sorry for not answering your question. We store user variables in cmi.suspend_data and so setting AICC_Core_Lesson would interfere with that. If you use Lectora's Modify Variable action to set the AICC_Lesson_Status or AICC_Lesson_Score variables then we also handle calling LMSCommit() to ensure data is saved off to the LMS.

    Hope this helps.

    - Joe