Change variable based on javascript results?

At the end of our courses, we have a course completion certification that includes the student's name.  I use a javascript to pull in the student name from the LMS.  Some of our courses, however, are used outside of the LMS (by contractors) and we have fields built into the beginning of the course requiring  the contractor to enter their name. 

What I'd like to do is create a T/F variable "Employee" with the default set to False.  Then, have it change to True if the javascript returns a user name from the LMS.  Any ideas how to do this?

Having this will allow me to create a slide trigger which will all the user (employees) to by-pass the manual name entry page if the employee variable is true, so that only contractors see the manual name entry fields.

Any ideas?



4 Replies
Mike B.

Bobbi, it appears that if you try to invoke the lmsapi command to get the name, and you're running outside of an LMS, then nothing happens. In that case you could probably set the name variable to a default value and then see if it changes after you try to get the name from the LMS. Does that make sense?

Matthew Bibby

Here's what I'd try:

  1. Create a text variable in SL called name. Give it a default value of unknown. 
  2. Have your js execute and see if it can grab a name from the LMS. If it can, have this value passed into your name variable.
  3. Then create a trigger that checks if name is equal to unknown, and if it is, have the course take the user to the manual name entry slide.