Issues Using a Storyline Block With JavaScript Trigger In Rise

Dec 30, 2020

Hi, all. I'm hoping to tap your collective brain. I am creating a "course" in Storyline 360 that evaluates some numbers input by a user to determine success or failure. I decided to do the math in a Javascript Trigger. I then put that "course" into Rise 360 as a SL block. The math does not appear to be executing.

I can see a few potential problem points, but searching the forums and support hasn't revealed any answers to some of the questions:

  • Can JavaScript Triggers run in Storyline Blocks?
  • Will JavaScript Triggers run correctly in Storyline Blocks in Review 360 in Chrome?
  • Is my JavaScript written correctly? I'm familiar with general, old-school programming principles, but not an expert in JavaScript.
  • Is there something else wrong that I don't even know about.

I've attached the .story file, in case anyone is willing to dig into it to provide assistance. The JavaScript is included in the trigger. I then published this "course" to Review 360 and used it in a Rise 360 course.

If you have any insights, I'd love to hear them. Thanks in advance!

2 Replies
Phil Mayor

Did you check if it works in review when you uploaded?

It doesn't work for me. Good practice is to check the Console for errors, I can see you are missing a " on line 11. 

Booleans are case sensitive You need to send "true" or "false" even then they are a little flakey.

I haven't worked through this to get it to work as I am unsure where I am meant to enter values. Is it all of the fields. I also note you are using text entry rather than data entry fields, which may cause a data type mismatch are you ensuring the string is converted to number? Finally by allowing users to send text you are likely to get some NaN back from the JS.

Phil Mayor

I found a couple more errors there is a "+" missing on line 53 Between


and then I am now stumped as you have an undefined variable:

var PercentSellableMeatWeight=SellableMeatWeightAC/SellableMeatWeightBC;

On line 57, you need to run through this is the console and ensure there are no errors. 

When using more than 2-3 lines of code, it is best to use a code editor like Atom so you can see some errors and then work with the console.