Skip to main content
Inspiring
Mar 29, 2018 8:12 AM UTC
Answered

Get a Student Name from LMS with JS

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 is closed to new replies. Start a new post to keep the conversation going.
Lilybiri
LilybiriCorrect answer
Legend
Mar 29, 2018 9:40 AM UTC

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.

18 replies

Known Participant
May 27, 2019 12:30 PM UTC

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

} 

})();

Translate
Participating Frequently
May 27, 2019 2:20 PM UTC

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

Let's see onside.

Thank you for this idea.

Translate
Participating Frequently
May 24, 2019 1:59 PM UTC

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?

Translate
Lilybiri
Legend
May 24, 2019 2:39 PM UTC

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.

Translate
Participating Frequently
May 25, 2019 7:56 AM UTC

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.

Translate
Lilybiri
Legend
Mar 29, 2018 8:22 AM UTC

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.

Translate
Inspiring
Mar 29, 2018 8:24 AM UTC

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

Translate
Lilybiri
Legend
Mar 29, 2018 8:26 AM UTC

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.

Translate