COUR_SetLatestVersion_TDTM
Course trigger handler/TDTM for setting Course Header: Latest Course Version and unsetting previous Course: Latest
Table of Contents
| Custom Permission | None |
| Event | BeforeUpdate, AfterInsert, AfterUpdate |
| Object | Course |
| Related RIO Education Settings | Enable Course Versioning |
Description
When a Course is inserted or updated, this trigger will populate/replace its parent Course Header: Latest Course Version with a lookup to this new/updated Course, and will unset Course: Latest on that Course Header's previous Course versions. This will only proceed if this is:
- an existing Course where either Course: Latest or Course: Course Header has been updated, or
- a new Course where Course: Latest = true and is not populated with a lookup to a Course Header.
A validation check is performed to prevent demoting the latest course version when no replacement is being promoted in the same transaction (there must always be a Latest Course).
Another check is performed to prevent a single Course Header from having multiple Courses set as Latest.