Forum Discussion
Olli
7 months agoCommunity Member
Getting JSON Data into Storyline?
We deliver our SL Courses on a LMS which hasn't the "normal" SCORM Interface. Here I want to get the User Name, Course ID etc... I got from the LMS Developer this code: -------------
try {...
garymoulton-a40
7 months agoCommunity Member
Try this:
try {
var player = GetPlayer();
// Replace this with the actual way your LMS provides suspendData
var suspendDataRaw = window.suspendDataRaw;
if (!suspendDataRaw) throw new Error("suspendDataRaw is undefined.");
var data = JSON.parse(suspendDataRaw);
player.SetVar("user_id", data.userId);
player.SetVar("course_id", data.courseId);
player.SetVar("lesson_id", data.lessonId);
player.SetVar("userName", data.userName);
} catch (e) {
console.log("Error parsing suspend_data:", e);
}
Related Content
- 10 months ago
- 11 months ago