General developer forum

Setting LTI launch custom parameter from JavaScript

Picture of Anthony Holland
Setting LTI launch custom parameter from JavaScript

Hi - I am not sure whether this should be here or on the general developer forums but I will start here.

We have a system design in which we connect a TomCat server to our Moodle instance via LTI. So our tool is hosted on the TomCat server. I can register our tool with our Moodle instance and specify a custom parameter with a fixed value, or a special LTI substitution variable like $CourseSection.sourcedId (full list of subsitution variables at )

Each time a student launches the LTI tool the TomCat server processes the launch message and sends some messages downstream and the TomCat server responds with some content which we display in Moodle. Great.

However, we would like to be able to set the value of the custom parameter from JavaScript or in some other way that allows us to pass into the LTI launch http post message a value entered by the student just before hitting the launch link.

I see this question has been posted in a few places over the years including earlier in 2018, but there are no answers. I wonder, is what we are trying to do in conflict with the design intentions of LTI? Should we rather capture the value we want in the tool, after launch? We are hoping to keep the interface section of our LTI tool to an absolute minimum (i.e. passing back a confirmation message, not implementing special forms etc). 

Is it possible to create another substitution variable, like $CourseSection.sourcedId, that we can set and specify as the value of the custom parameter? Or could we piggyback one of the existing substitution variables, somehow setting its value?

Really any way of getting a value to the TomCat server without abandoning and circumventing the LTI interface would be fine.


Average of ratings: -