Skip to main content
Inspiring
March 29, 2018
Answered

Get a Student Name from LMS with JS

  • March 29, 2018
  • 3 replies
  • 3119 views

Hi there,

I checked a few discussions but could not get it to work..

I want to get the LMS Student name with JS in Captivate 2017. I manage to get the name in a Developer console with this line

API.LMSGetValue('cmi.core.student_name');

But not in a Captivate project.

Thanks in advance for the ideas

Bobby

This topic has been closed for replies.
Correct answer Lilybiri

Yes, the $$cpQuizInfoStudentName$$ variable makes a reference to the 'cmi.core.student_name' in SharePoint LMS. So it is a funky way to get to what I want. However, I would like to understand the JS lines one should use to get to other variables. I know you are not much of a JS person but maybe you have seen what the lines are? Thanks Lieve B

PS. Moreover, it takes the full name. I would like to be able to split First and Last name


I use cpAPIInterface.getVariableValue('cpQuizInfoStudentName'). Bookmarked this page:

Learn about the Common JavaScript interface for Adobe Captivate

You can then use JS functions to take out the first and last name, depends on the structure of the variable value.

3 replies

Known Participant
May 27, 2019

Maybe some of this could help you?

//___

(function(){

var stuName='';

if (typeof window.GetStudentName==='undefined'){

stuName='Name Not Found';

} else {

stuName=GetStudentName();

if(stuName==''){         

    stuName='Name not found on LMS'; 

} else {

       

}   

    var objCp=document.getElementById('Captivate');   

if(objCp && objCp.cpEISetValue){  

objCp.cpEISetValue('m_VarHandle.StoreName', stuName);

})();

Participating Frequently
May 27, 2019

Now I tested GetStudentName() from the standard Captivate lms. It returns the same username.

Let's see onside.

Thank you for this idea.

Participating Frequently
May 24, 2019

Hi!

The customer installed our course to the Workday LMS and can't see the right student name.

I used two methods to get information about the learner:

cpQuizInfoStudentName and SCORM_CallLMSGetValue("cmi.core.student_name");

but the system shows "Workday, Learner".

Maybe somebody has an experience to solve it?

Lilybiri
Brainiac
May 24, 2019

Do you have any idea how the account data are for that LMS? Do they use a 'username' and if yes, does it look like the real name of the student?

Not every LMS will transfer the user name to the Cativate user variable cpQuizInfoStudentName, not to cpQuizInfoStudentID. Both those user variables were originally created to be used for transfer to an interanal server. Some LMS's populate those variables, others do not.

Participating Frequently
May 25, 2019

There is an unique user name in the Workday. It looks like normal first and last names.

The Workday has an open API to access data with human resources such as Get_Workday_Account.

It would be nice to find some example, how to get Workday credentials using java script.

At the moment the fastest solution is to use the input form inside of the course, but it is not, what we need actually.

Lilybiri
Brainiac
March 29, 2018

Did you check if the variable cpQuizInfoStudentName is not filled in automatically in the LMS? That user variable is created by default in each project.

Inspiring
March 29, 2018

Thanks Lieve

The variable that I get in a console with this command

API.LMSGetValue('cmi.core.student_name');

is  my name from the SharePoint LMS that we use, so it has nothing to do with the cpQuizInfoStudentName I believe.

B

Inspiring
March 29, 2018

Did you check? Lot of LMS's do use the student name to fill in that variable. I don't know about your LMS, but worth checking, takes only seconds.


Yes, the $$cpQuizInfoStudentName$$ variable makes a reference to the 'cmi.core.student_name' in SharePoint LMS. So it is a funky way to get to what I want. However, I would like to understand the JS lines one should use to get to other variables. I know you are not much of a JS person but maybe you have seen what the lines are? Thanks Lieve B

PS. Moreover, it takes the full name. I would like to be able to split First and Last name