Copy link to clipboard
Copied
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
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
I'm sorry, but cannot help you with that. Told that not all LMS's do populate the variables.
Copy link to clipboard
Copied
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}";
Copy link to clipboard
Copied
Fine, did you check it out?
Copy link to clipboard
Copied
At the moment no, will see in the future.
Copy link to clipboard
Copied
Were you able to access the Workday LMS student name using a web service or API? Having same issue š
Copy link to clipboard
Copied
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);
}
})();
Copy link to clipboard
Copied
Now I tested GetStudentName() from the standard Captivate lms. It returns the same username.
Let's see onside.
Thank you for this idea.