Skip to main content

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 = nameArrays1].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

 

If I understood correctly you would need this API call https://doceboapi.docebosaas.com/api-browser/#!/manage/User/User_manage_v1_user_user_id


Reply