Forum Discussion

TrainingEco-Alp's avatar
TrainingEco-Alp
Community Member
2 years ago

JavaScript with Adobe Learning Manager

I have been researching for a couple days now, and I have found some good JavaScript code for pulling information from the LMS and putting it into variables in my slide. I have been able to get this to work with Scorm Cloud, but as soon as i put it in Adobe Learning Manager, it no longer works. I have been trying to find what I need to do to make it specific to my LMS, but have had no luck.

In short, I want a certificate of completion that pulls in the learner name and course name. Anyone had success with this specifically in Adobe Learning Manager? Or know what I might be doing wrong? Below is the code I am using:

var player = GetPlayer();

var myName  = lmsAPI.GetStudentName();

var array  = myName.split(',');
var newName = array[1] + '  ' + array[0];

player.SetVar("lmsName", newName);

//myName = player.GetVar('myName');

//player.SetVar("lmsName", newName);
  • SandeepGadam's avatar
    SandeepGadam
    Community Member

    Hello there could you give it a try with the code provided below:

    var player = GetPlayer();
    console.log("Player: ", player);

    var lmsAPI = window.parent;
    console.log("LMS API: ", lmsAPI);

    var myName = lmsAPI.GetStudentName();
    console.log("Original Name: ", myName);

    var array = myName.split(',');
    var newName = array[1] + ' ' + array[0];
    console.log("New Name: ", newName);

    player.SetVar("lmsName", newName);
    console.log("lmsName variable set to: ", newName);

    Let me know if that works for you!!

    Additionally, check if there are any JavaScript errors in the Adobe Learning Manager console or logs. Some LMS provide their own JavaScript APIs or methods for interacting with learner data.

    Thank you!!

  • Thank you for this. Unfortunately it didn't work. I also have a ticket into Adobe explaining what I am trying to do, and asking for the correct APIs for methods to get there. I found some info, but I am not sure how it all goes into the overall script so hopefully they can help me.

    Thanks again!