Unable to display student name in course certificate

Hiii,

In our client LMS student name is not displaying in the course certificate. We have used the javascript to display the name. The name has to be extracted from a json string. 

Sample Json string format: 

{"title":"Indu","first_name":"Indu","last_name":"Faculty","mobile":" 91-8676786989","name":"indu_faculty@mailinator.com","uid":"288393","mail":"indu_faculty@mailinator.com","active_language":null,

"created_at":"1584680765","role":"Trainer"}

The script written to extract the name :

var player = GetPlayer();
function findLMSAPI(win) {
// look in this window
if (win.hasOwnProperty("GetStudentID")) return win;
// all done if no parent
else if (win.parent == win) return null;
// climb up to parent window & look there
else return findLMSAPI(win.parent);
}
var lmsAPI = findLMSAPI(this);
var studName = lmsAPI.GetStudentAttributes();
var obj = JSON.parse(studName);
var newName = obj.first_name + " " + obj.last_name;
player.SetVar("newName", newName);

Please help us in this ASAP.

Be the first to reply