Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Need javascript to send completion on SCORM lesson_status

New Here ,
Jul 24, 2015 Jul 24, 2015

I need help with Captivate 7.0.1.237 - on Windows 7

I don't want to use slides viewed OR quiz score to send a completion to the LMS

I have researched javascript - on the web - and the best I can come up with is shown below

var CaptivateObj = document.Captivate;

g_objAPI.LMSSetValue('cmi.core.lesson_status', 'completed');

g_objAPI.LMSCommit('');

g_objAPI.LMSFinish('');

I have tried setting the script to Top, parent, current, new - and have tested a TEST Captivate SCORM package on SCORM Cloud

I have created a simple 5 slide package - with the javascript executing ON EXIT for slide 2 - on slide 3 I have an exit button

IT doesn't work - that is, it doesn't send a completion

I can send the sample Captivate file with the embedded javascript if that would help

Phil Camillo

philcamillo@gmail.com

TOPICS
Advanced , Editing , Quizzing and LMS
8.7K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

People's Champ , Jul 29, 2015 Jul 29, 2015

Those are old SCORM calls. The "g_objAPI" doesn't exist.

use:

SCORM_CallLMSSetValue('cmi.core.lesson_status', 'completed');

SCORM_CallLMSCommit();

SCORM_CallLMSFinish();

Since these functions exist outside of Captivate, you do not need to funs the Captivate object.

Translate
Explorer ,
Jul 24, 2015 Jul 24, 2015

Try putting the javascript in the onEnter for slide 2.  Using onExit is a little tricky to wrap your head around.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 24, 2015 Jul 24, 2015

Thanks Dan

I will try this right now - I have really struggled to find ANYTHING out there on script to send a SCORM completion

Do you think the javascript I wrote looks like it will work?

P

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 24, 2015 Jul 24, 2015

Looks reasonable.

Add console.log ("hello javascript");  and then check your console in chrome (F12) to ensure that your code is running.

(remove any console.log() statements from production code since IE will throw an error on it)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 24, 2015 Jul 24, 2015

OK - will try this

BTW - I am not a javascript guy - I just happened to know about SCORM - and through searching a number of sites - gobbled together the script - which, like you said - looks "reasonable"

Phil

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 24, 2015 Jul 24, 2015

Hi Dan - same result with adding to ON ENTER - still getting an incomplete when tested at SCORM cloud

testjava.PNG

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 24, 2015 Jul 24, 2015

Like I said, add the console.log statement to ensure that your code is even running, and/or there are no errors showing up in the console

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Jul 29, 2015 Jul 29, 2015

Those are old SCORM calls. The "g_objAPI" doesn't exist.

use:

SCORM_CallLMSSetValue('cmi.core.lesson_status', 'completed');

SCORM_CallLMSCommit();

SCORM_CallLMSFinish();

Since these functions exist outside of Captivate, you do not need to funs the Captivate object.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 29, 2015 Jul 29, 2015

Thanks so much for the new code - I will try this right away

Question - does it make any difference in the javascript settings - if I set it to either top, parent, current or new?

Thanks again

Phil

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Jul 29, 2015 Jul 29, 2015

I always use the default "current"

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 29, 2015 Jul 29, 2015

AWESOME - AWESOME - AWESOME!!!!

IT WORKED - thank you so much - WOW

The only thing is that it exited at the completion - which is probably the SCORM_CallLMSFinish(); command

I will take that out - so I just have Commit

javacomplete.PNG

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 25, 2018 Mar 25, 2018

HI,

I was looking out for similar solution and found you have answered it.

I am newbie and not from programming background. Can you help me what is current and when should we paste the code to let LMS know the course status is complete.

Thanks in advance.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Mar 26, 2018 Mar 26, 2018

Just paste the code on Enter of the slide where you want to register completion.

If I understand you correctly "current" is the window the script should be executed in. In this case and almost all cases, it should be "current".

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 28, 2018 Mar 28, 2018

Hi there, I wanted to share my experiences.

Using Captivate 2017 and SharePoint LMS.

The following works well with SCORM 1.2 but NOT with SCORM 2004. Need to specify that I hook the script to a button, not to OnEnter event.

SCORM_objAPI.LMSSetValue("cmi.core.lesson_status", "completed");

SCORM_objAPI.LMSCommit('');

SCORM_objAPI.LMSFinish('');

The following works neither with 1.2 nor with 2004

SCORM_CallLMSSetValue('cmi.core.lesson_status', 'completed');

SCORM_CallLMSCommit();

SCORM_CallLMSFinish();

I am ok with it since 1.2 works well for me. However, from purely theoretical point of view, what is that I am missing?

Thanks

Bobby

PS. Great blog TLC guys! BTW, can one use the Console of the F12 Developper tools change the status from there?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 02, 2021 Sep 02, 2021
LATEST

Brilliant!  Worked for me!  Thanks for posting!

 

Note that SCORM_objAPI.LMSFinish(''); closes the window/exits the course, so making a trigger on a button makes sense.

 

I used your two lines as a javascript trigger when the timeline starts:

SCORM_objAPI.LMSSetValue("cmi.core.lesson_status", "completed");

SCORM_objAPI.LMSCommit('');

 

Then have an exit button where I just use the built-in Exit trigger.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 23, 2015 Nov 23, 2015

Hey All, Nice to see this for SCORM, any chance there is a version that will work with AICC?

Thanks,

  Tim Munroe

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Nov 23, 2015 Nov 23, 2015

Never used AICC, but you can try this:

AICC_TranslateLessonStatusToAICC("C")

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 23, 2018 Jan 23, 2018

Thanks, TLC. This worked perfectly with SCORM and EdApp.

Much better than Captivate's Success/Complete Criteria.

Put your code on an EXIT button, and the course is exited and a "completion" is recorded. PERFECT!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 07, 2018 Dec 07, 2018

Most of the solutions provided here are dependent on the particular protocol (SCORM 1.2 / 2004, AICC, etc)

I have found that if you simply the run the line below built in functionality will use whichever protocol is appropriate and send the completion status.

SetReachedEnd()

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 16, 2020 Oct 16, 2020

For scorm 2004 set completion status use below code in the end of the slide.

set in javascript :- SetReachedEnd();

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Help resources