public static function preload_custom_fields(array &$records) {
        $customfields = \core_course\customfield\course_handler::create()->get_instances_data(array_keys($records));
        foreach ($customfields as $courseid => $data) {
            $records[$courseid]->customfields = $data;
        }
    }