Course Name variable (for SmartSheet)

Sep 13, 2019

Goal:  Prefill in as many fields as we can for users on a SmartSheet survey form at the end of our University courses (100s of courses will be updated with this new feature).

I am using JS to extract the UserID and UserName.  This is working.

QUESTION:  Is there already an existing easy way to extract the coursename from already designed courses?   

 My current (ugh) plan is to edit each course, create a variable where I manually add the course name.  Then my already constructed JS will create the smartURL that the user will be given at the end of the course that will prefill in the fields as the form opens.

I would love to just drop in the new javascript without having to manually add in course-specific variables.

Any brilliant paths to that goal?   Thanks in advance.

7 Replies
Jerry Beaucaire

My final code, for your reference:

//Put name of student into variable "username"
//Construct a URL with the student's name included in variable "smartURL"

var feedbackform = ""
var player = GetPlayer();
var docname = document.title

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);
var myName = lmsAPI.GetStudentName();
var array = myName.split(',');
var newName = array[1] + '%20' + array[0];
player.SetVar("username", array[1]);

if (newName) {
player.SetVar("smartURL", feedbackform + "?Name=" + newName + "&Course=" + docname);
player.SetVar("smartURL", feedbackform + "?Course=" + docname);

And here is the JS that is connected to the FEEDBACK button in the course

//Open the smartURL link created earlier
var player = GetPlayer();
var win ="smartURL"));

Sherri Sagers

Hi Jerry! I'm trying to prefill an embedded Smartsheet form with the learner's quiz score and a few other Storyline variables, which I think is what you're describing here. I'm new to Smartsheet but I've done something very similar with Google Sheets, so I think (hope!) I'm following your explanation. My questions:

1. Where do you put the first set of code? (On the first slide of the Storyline project?)

2. In your first set of code, is the "" URL the same URL you get to embed the form?

3. (Longshot...) All of my courses are in Rise, with Storyline embedded - sometimes in more than one place. I'm putting the Smartsheet survey forms at the end of the Rise projects. Is there any way to pass the Storyline variables into a Smartsheet form that isn't embedded in the Storyline project itself, but later on in the same Rise course? (... she asks with only the tiniest glimmer of hope...)

Thank you for any help you can give me! <3

Jerry Beaucaire
  1. For me, yes.  My code does all the work at the onset because I'm not gathering end-of-course data like scores or metrics.

    For you, just remember to put your code that constructs the smartURL with your metrics added to the URL into your course at a point after those metrics have been created.  So that could be as the first trigger events on the RESULTS slide, perhaps?

  2. The base URL is the same one I get from SmartSheet to open the form from anywhere.  So I think... yes.

  3. I've only used Rise twice, so not an expert at all on Rise's ability to read/write/pass JS variables.  Sorry.