Forum Discussion

EmilyKnox-Cl401's avatar
EmilyKnox-Cl401
Community Member
6 days ago

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

  • 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);
    },

     

  • JoeFrancis's avatar
    JoeFrancis
    Community Member

    Keep in mind that eLearning apps like Storyline, Rise, Captivate, and others are using SCORM data elements to retrieve and populate information. While a user's name is a SCORM data element (cmi.core.student_name in SCORM 1.2; cmi.learner_name in SCORM 2004) which can be retrieved by a learning object, there is no data element in the SCORM specification for something like "job family" or "reporting unit."

    FWIW, there ALSO isn't a data element dedicated to the learner's email address.

    SCORM Run-Time Reference Guide

    • MathNotermans-9's avatar
      MathNotermans-9
      Community Member

      Although Joe is correct, it is no issue, as in your code you already separated Scorm/LMSApi calls and specific Docebo API calls. We use CanvasLMS. Also a Canvas specific API is available to do more and other things then with Scorm.

      As im experimenting myself with the Canvas API, i just found a great tool to use API's easily. If your code then works, its just copy and paste to Storyline.
      Postman is the tool i use.