Forum Discussion
EmilyKnox-Cl401
4 hours agoCommunity Member
Pull data from Docebo to Articulate Storyline 360
I’m trying to pull data from Docebo to personalise eLearning and I have managed to pull the users first name to display in the eLearning, however I was wondering knows of a way to do the same for a “job family 1” or “job family 2” or “reporting unit 1” to personalise the route someone takes in their learning.
This is the code I’ve been working on
var player = GetPlayer();
function findLMSAPI(win) {
if (win.hasOwnProperty("GetStudentID")) return win;
else if (win.parent == win) return null;
else return findLMSAPI(win.parent);
}
var lmsAPI = findLMSAPI(this);
// Fetch the student's name
var myName = lmsAPI.GetStudentName();
var nameArray = myName.split(',');
var firstName = nameArray[1].trim(); // Assuming the first name is the second element
player.SetVar("firstName", firstName);
// Fetch the job family
function getJobFamily() {
var jobFamily = "";
$.ajax({
url: "https://your-docebo-instance/api/user/v1/users/me",
type: "GET",
async: false,
headers: {
"Authorization": "Bearer YOUR_ACCESS_TOKEN"
},
success: function(response) {
jobFamily = response.data.job_family; // Adjust based on actual API response
},
error: function() {
console.log("Error fetching job family");
}
});
return jobFamily;
}
var jobFamily = getJobFamily();
player.SetVar("jobFamily", jobFamily);
Thank you
- MathNotermans-9Community Member
Noticed you already posted the same question to the Docebo community ;-)
Guess someone with indepth knowledge of the Docebo API can answer it best.
Do add some logs to your code... to see whether you are getting response from the API.success: function(response) { jobFamily = response.data.job_family; // Adjust based on actual API response console.log("Docebo says "+response); },