Building hyperlinks using variables/js

Hi all. I want to build a custom hyperlink within Storyline, using data collected from the LMS (SCORM2004 3rd ed). 

First, I need to extract the user ID from the LMS, which my LMS suppliers say can be achieved using the cmi.core.learner_id call. Can Storyline pull this data? How?

Second, I need to insert this user ID into a URL, thus customising the URL to include that user's unique ID. Again, can I do this in Storyline and how?

Third, I need to add a trigger to a button in Storyline that opens this URL in another browser window. How do I pull that URL (which is probably part of a variable) to utilize it in a trigger?

As this is going to cost me money for the LMS suppliers to populate the cmi.core.learner_id field and make other changes, I'd like to know for sure whether Storyline can indeed carry out the functions we need, be it with triggers, variables or Javascript. 

Thanks in advance. 


3 Replies
Matthew Bibby

Hi Steven,

I'm not 100% sure this will work (as I haven't tested it) but give this a try...

To test, add this JavaScript to an Execute JavaScript trigger in Storyline, publish as SCORM 2004 and upload to SCORM Cloud. When the trigger executes it should search google for your learnerID.

var lmsAPI = parent;
var learnerID = lmsAPI.SCORM2004_CallGetValue("cmi.learner_id");"" + learnerID);

Once you have confirmed that it works, just change to the url you want to use. 

Also, if you want to display the learnerID in Storyline, create a text variable in Storyline called SL_learnerID and then use the following JavaScript:

var lmsAPI = parent;
var learnerID = lmsAPI.SCORM2004_CallGetValue("cmi.learner_id");
var player = GetPlayer();

This should set the variable SL_learnerID with the data returned from the LMS. Then, add the reference %SL_learnerID% to a text box in your Storyline file and that will display the learner ID.

Hope this helps. Let me know how you get on.



Steven McAneney

Thanks Matt. I tried both and they worked. Excellent. The only fly in the ointment is that my LMS suppliers are asking for cmi.core.learner_id, which seems strange as I though that was a SCORM 1.2 call, I'm using SCORM 2004. I've sent the results of my testing back to them. Again, thanks for the help.