Tracking the quiz result using a javascript trigger

May 18, 2020

Hi

I am a newbie to javascript. After reviewing several discussion posts and tried several options, I would appreciate your support with the correct javascript that allows me to track the quiz result in the LMS. For this situation, the score does not influence the pass or fail. The course completion is based on a completion trigger.

The last code I used without success was:

var lmsAPI = parent;
var player = GetPlayer();
var Results.ScorePercent = player.GetVar("LMS");
lmsAPI.SetScore(Results.ScorePercent, 100, 0);

What am I doing wrong? Thank you in advance for your support.

6 Replies
Ren Gomez

Hi Maria,

Hopefully a community member with Javascript expertise can chime in with their tips, but can you shed a little more detail into why you're tracking using a completion trigger and not quiz result?

One item to keep in mind is setting an LMS reporting status to Passed/Incomplete or Passed/Failed, as that will most likely record success and completion. You can read more about that here:

Looking forward to hearing back!

Maria Tavares

Hi Phil

Thank you for your reply. It was the insight I was needing to come up with the solution.

I was not able to make my previous javascript work even with the new variable. So after further digging, I was able to track the results using the following javascript:

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);

lmsAPI.SetScore(player.GetVar("lmsScore"), 100, 0);

Have a joyful day! Thank you!

Steve Hazelton

Hi Maria -

I posted a somewhat related thread yesterday https://community.articulate.com/discussions/articulate-storyline/showing-test-out-score-in-lms-not-final-score  and I am wondering if what you are doing might help me with my problem? You call yourself a newbie to javascript but you clearly know more than me!

Thanks.

 

 

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