Print Results - automatically grab username from LMS

I know from a previous thread that it is possible to get the username from the LMS and store it in a Storyline variable. What I'd like to do is to automatically include this when printing a results screen (report.html) page. Right now the user is prompted to enter their name, but if we can get the name from the LMS, we can bypass this step, surely?

Any ideas?

5 Replies
Christie Pollick

Hi, Andrew -- Thanks for your question! Aside from the suggestions offered over here in the post I believe you referred to above, I am not aware of another way to suggest to accomplish automatically including the username when printing a results screen (report.html) page. 

Hopefully, others in the community will be able to share some additional ideas to assist. :)

Matthew Bibby

Hi Andrew,

Give this JavaScript a try:

var lmsAPI = parent
var rawName = lmsAPI.GetStudentName();
var nameArray = rawName.split(",")
var reorderName = nameArray[1] +" "+nameArray[0];
var p = GetPlayer();
p.SetVar("printUserName",reorderName);

Note that you will need to create a variable called printUserName in Storyline for this to work.

Andrew Dunn

Thanks Matthew - that certainly gets me the username into a Storyline variable, but what I actually need to do is to have this value passed to the printed report. Right now the user has to retype their name in a popup dialog box whenever they print their results - I want to remove that step, and have the username passed directly to the printed report.

Christie Pollick

Hi, Andrew -- As the use of JavaScript has been suggested to accomplish what you have in mind, I thought I'd stop back in to mention that we are not able to provide JavaScript support. But, there are lots of knowledgable community members who are more than happy to assist with JS! And here is our JS Best Practices sheet if you'd like to check it out. :)