Copy link to clipboard
Copied
Hello. I have a project where I need to import the student_id variable from the LMS and then to add it at the end of the web address of a web object. I have contacted the LMS support to ask and what I got back is: "Make use of the SCORM Javascript function to access the StudentID. We do not support or recommend any approach outside the usage of StudentID. To do this, you can use the following in your course code: API.LMSGetValue( “cmi.core.student_id” ) (Where ‘LMS’ is the SCORM API Javascript variable in your code.". I am not familiar with javascript much, so I wrote:
var student = API.LMSGetValue( “cmi.core.student_id” ); but the student variable in my project was not changed with this code.
After I get the variable, I have to send it to API with web object, and the address should be something like:
where student is the variable taken from the LMS.
Have anyone got similar task? Thank you very much.
Kind regards, Marko
Copy link to clipboard
Copied
Did you check the automatically creates (user) variables cpQuizInfoStudentID and cpQuizInfoStudentName? It depends on the LMS but they could be populated by the data from the LMS account.
As for having a variable in an URL string, I would use the CpExtra widget (InfoSemantics):
http://www.infosemantics.com.au/adobe-captivate-widgets/cpextra/help/miscellaneous-features
Copy link to clipboard
Copied
Thanks for the answer. I have tried with both, but unfortunatelly both veriables are problematic.
cpQuizInfoStudentID does not return anything, and cpQuizInfoStudentName returns the name in the format: LASTNAME, FIRSTNAME.
What I have tried is to do with the cpQuizInfoStudentName is:
var getName = window.cpAPIInterface.getVariableValue( "cpQuizInfoStudentName" );
var newName = getName.replace(/\, /g,'');
window.cpAPIInterface.setVariableValue('user2', newName);
I tried to remove the comma and the space between surname and name to receive the variable in format: LASTNAMEFIRSTNAME and send the value to my variable user2 as one word, but the code was not working. Actually, getting student id is more important because we can have two people with the same name, but in case nothing works for the ID, even the student name is satisfactory. For the student id I tried this:
var getName = API.LMSGetValue( “cmi.core.student_id” );
window.cpAPIInterface.setVariableValue('user2', getName);
to take the student_id variable as explained by the LMS support, but also without results.
Thanks about the widget CpExtra. I already purchased it (and the video tutorials how to work with those), so probably I would figure it out, first I need to convert variables.
Thank you very much for your efforts.