Hi all,
I’m working on a custom homepage widget in Brightspace that shows a learner’s course progress using status icons. Each course is linked to up to four OrgUnitIDs:
- Main course (e.g. ODS214)
- ENROLLED (e.g. ODS214-ENROLLED)
- COMPLETE (e.g. ODS214-COMPLETE)
- EXPIRED (e.g. ODS214-EXPIRED)
- Optional: GRANDFATHERED (e.g. ODS214-GRANDFATHERED)
The widget uses GET /d2l/api/lp/1.9/enrollments/myenrollments/{orgUnitId} to dynamically check enrollment in each OrgUnit and assign the correct status icon. It works great — except in one scenario:
Problem:
If the learner is only enrolled in the EXPIRED OrgUnit (e.g. 11323) and not also in the ENROLLED or COMPLETE OrgUnits, then the API returns a 404 Not Found.
- The learner is enrolled in the EXPIRED OrgUnit (confirmed in LMS).
- The API call still returns 404.
- In our LMS, learners are only enrolled in one OrgUnitID per course at a time (due to Intelligent Agents).
This causes the widget to default to a “Not Enrolled” state, even though the EXPIRED OrgUnit enrollment exists.
What works:If the learner is enrolled in both EXPIRED and either ENROLLED or COMPLETE, the red Expired icon displays correctly.
Sample logic (simplified):
const expired = course.expiredId
? await CSPS.get.amIenrolledOrgUnit(course.expiredId)
: false;
Questions:- Is the 404 response expected behavior when a learner is only enrolled in an OrgUnit with a label like “EXPIRED”?
- Could this be related to how OrgUnits are flagged or categorized in Brightspace?
- Is there any caching or filtering layer in the
myenrollments endpoint that could cause certain OrgUnits to be hidden?
Any guidance or confirmation would be much appreciated! Happy to provide further code or screenshots if needed.
Thanks,
Carlos.