Moodle/Totara | Create custom fields for a course

|
| By Webner

Create custom fields for a course in Moodle/Totara.

1. Go to Site administration. Select custom fields inside Courses as shown below:

2. Select option – which type of custom field do you want (say, menu of choices):

3. Fill the below form as per your requirement and save:

4. Now the custom field is ready for the courses. To select a value for this custom field for any course go to course edit page. Since we have created a drop down type of field so we see the custom field label and the dropdown with values we had entered. Select the value for course being edited and save your changes:

5. Now to retrieve this field value from database for a course, run below query:

select cif.id,cid.data from {course_info_data} cid JOIN {course_info_field} cif ON cif.id = cid.fieldid and cif.shortname= 'cf' and cid.courseid = ‘courseid’;

Where, ‘ courseid ‘ is the course id whose custom field value we want to retrieve.
‘ cf ‘ is the short name of custom field as set above.

Leave a Reply

Your email address will not be published. Required fields are marked *