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

Get a Student Name from LMS with JS

Engaged ,
Mar 29, 2018 Mar 29, 2018

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

2.4K
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

Community Expert , Mar 29, 2018 Mar 29, 2018

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.

Translate
Community Expert ,
Mar 29, 2018 Mar 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.

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 29, 2018 Mar 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

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 Expert ,
Mar 29, 2018 Mar 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.

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 29, 2018 Mar 29, 2018

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

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 Expert ,
Mar 29, 2018 Mar 29, 2018

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.

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 29, 2018 Mar 29, 2018

But how do you get that value on the screen?

The line gets the value, but which line would display the value in a text caption?

sorry, I am not the JS guy as you can see

Thanks

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 Expert ,
Mar 29, 2018 Mar 29, 2018

You'll have to get the result of the manipulated variable in JS back into a user variable with cpAPIIntervade.setVariableValue(...) . Once it is in a Captivate variable you can insert it in a text container. I used this in a simple mathematical example:

Playing with Numbers - part 1 - Captivate blog

There are several JS experts around, I only use JS when advanced/shared actions are failing or becoming too cumbersome.

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 29, 2018 Mar 29, 2018

Thank you, that is great as usual. I managed to do the following

1. Created a custom variable in Captivate - myCustomLearnerName

2. OnEnter of the Slide insert the following

window.cpAPIInterface.setVariableValue("myCustomLearnerName", cpQuizInfoStudentName);

Actually, I tried the TLC's solution here https://forums.adobe.com/message/8451467#8451467 and it worked to return the first name only.

var getName = window.cpAPIInterface.getVariableValue( "cpQuizInfoStudentName" );

var newName = getName.split(",");    

newName .reverse();    

window.cpAPIInterface.setVariableValue("v_FirstName", newName[0]);

Thanks Lieve

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 ,
May 24, 2019 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?

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 Expert ,
May 24, 2019 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.

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 ,
May 25, 2019 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.

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 Expert ,
May 25, 2019 May 25, 2019

I'm sorry, but cannot help you with that. Told that not all LMS's do populate the variables.

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 ,
May 25, 2019 May 25, 2019

Ok. Thank you.

By the way I found something useful:

var proxy = new Human_ResourcesPortClient(cb, new EndpointAddress("https://wd2-impl-services1.workday.com/ccx/service/{tenantID}/Human_Resources"));
proxy.ClientCredentials.UserName.UserName = "{username@tenantID}";

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 Expert ,
May 25, 2019 May 25, 2019

Fine, did you check  it out?

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 ,
May 25, 2019 May 25, 2019

At the moment no, will see in the future.

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 ,
Apr 11, 2020 Apr 11, 2020
LATEST

Were you able to access the Workday LMS student name using a web service or API? Having same issue 😞

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 ,
May 27, 2019 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);

})();

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 ,
May 27, 2019 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.

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