How can I trigger custom JavaScript after a quiz submission?
Hi everyone,
I’m currently working on a custom integration within D2L Brightspace, and I’m trying to figure out if there’s a way to trigger a JavaScript function or API call immediately after a quiz is submitted by a student.
We’re trying to push quiz completion data into an external system in real time not just rely on grade exports or data hubs. I’ve checked through the Valence API and Events documentation, but it’s still a bit unclear if there's a reliable method for this kind of "post-submission" hook.
Thanks in advance.
These guys are really helpful we’ve tackled similar real-time workflows at: Richmond VA
Answers
-
Hello Max,
Thanks for reaching out!
In terms of pulling completion data, have you looked into the available API's for quizzing in our valence documentation?
To determine if a user has completed a quiz, the Quiz Attempt API provides the relevant data. It returns a Quiz.QuizAttemptData object, which includes a completed parameter indicating whether the quiz attempt has been finished. You could build a script on a schedule that fetches the latest attempts and returns this JSON data
Please review these API calls and If you have any questions or concerns, please do not hesitate to contact me directly.
Let me know if the following helps or if you have any questions or concerns!