Found this content helpful? Log in or sign up to leave a like!
How to access $Canvas.assignment.id in our LTI1.3 app
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In short, am attempting to access LTI variable substitution $Canvas.assignment.id and it is returning $Canvas.assignment.id and not the expected id. Also, is an assignment is considered as having been "launched as an assignment" when the Instructor has opened it.
Background: Currently we show a list of Assignments in our in-house AssignmentTools LTI1.3 app which is accessed from the main course menu. The user chooses one and works with that Assignment.
To streamline our UI, we would like to use the assignment_menu placement in our Dev Key setup, so the user can go directly to their assignment details in the in-house Tool from the Canvas assignment. The tool appears in the correct place as we've added the following json to our Dev Key setup.
"placements": [
{
"placement": "assignment_menu",
"message_type": "LtiResourceLinkRequest"
},
We already use Custom Params in the Dev Key setup to pick up detailed role information and that is working fine. But Canvas.assignment.id is coming back as $Canvas.assignment.id
"custom_fields": {
"our_roles": "$Canvas.membership.roles",
"assignmentId": "$Canvas.assignment.id"
},
The documentation suggests Instructure are not making assignment.id available at the point it's needed.
"If the tool consumer doesn't recognize, or can't substitute, the value it will just send the variable as if it were are regular custom variable (i.e. the name of the substitution variable will be sent rather than the value)."
The documentation also says:
Canvas.assignment.id
Returns the assignment_id of the assignment that was launched.
Availability: when launched as an assignment
Does anyone know what Canvas means by launched as an assignment? I assumed if you opened the assignment as an Instructor, you would have launched it, but maybe not?
We've also tried to find the assignment id in the http parameters but it does not seem to be there. E.g. the referer url has no ?xxxx=yyyyy
It would seem crazy if you can add an LTI Tool to the context menu of an assignment, and not have access to the canvas assignment id.
If anyone has managed to use the $Canvas.assignment.id or has any thoughts what's going wrong, I'd be most grateful!