# Enabling Custom Course Settings

**URL:** <https://discuss.openedx.org/t/enabling-custom-course-settings/7337>\
**Category:** Development\
**Created:** [May 25, 2022, 6:54pm UTC](https://discuss.openedx.org/t/enabling-custom-course-settings/7337 "2022-05-25T18:54:57Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andres.Aulasneo](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/andres.aulasneo/32/984_2.png) [@Andres.Aulasneo](https://discuss.openedx.org/u/Andres.Aulasneo)\
**Post date:** [May 25, 2022, 6:54pm UTC](https://discuss.openedx.org/t/enabling-custom-course-settings/7337/1 "2022-05-25T18:54:57Z")

</div>

Hi all,  
I’ve found this interesting feature: [Enabling Custom Course Settings](https://edx.readthedocs.io/projects/edx-installing-configuring-and-running/en/open-release-maple.master/configuration/enable_custom_course_settings.html#enabling-custom-course-settings).  
This adds an “Other course settings” field in the course’s advance configuration.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/openedx/original/2X/2/21a75971c36aab7bf1d2e793eed6e503645c5753.png)  
Does anybody know where is this data stored? How can it be used in another application?

---

<div class="post-metadata">

**Author:** ![dave](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/dave/32/263_2.png) [@dave](https://discuss.openedx.org/u/dave)\
**Post date:** [May 26, 2022, 3:09pm UTC](https://discuss.openedx.org/t/enabling-custom-course-settings/7337/2 "2022-05-26T15:09:04Z")

</div>

There’s a brief description included in the PR that brought that feature into the platform:

> <https://github.com/openedx/edx-platform/pull/17699>
>
> This adds a field to the "advanced settings" page of each course that allows the… user to store additional metadata about the course, in a JSON dictionary, without requiring updating the platform code.
> 
> The idea is that this field can hold metadata like "ID of the course in external system", course difficulty, or other instance-specific metadata about the course that needs to be available to the theme, CRM software, a marketing site, ecommerce, or other external systems.
> 
> The new field is protected by a feature flag which is \`False\` by default, so it won't show up in Studio unless you enable the flag.
> 
> \*\*JIRA tickets\*\*: None
> \*\*Discussions\*\*: None
> \*\*Dependencies\*\*: None
> \*\*Screenshots\*\*: None
> \*\*Sandbox URL\*\*: TBD
> \*\*Merge deadline\*\*: None
> 
> \*\*Testing instructions\*\*:
> 
> 1. Add a setting under \`FEATURES\` in \`cms.env.json\`: \`"ENABLE\_OTHER\_COURSE\_SETTINGS": true\`
> 2. In Studio, go to „advanced settings“, you'll see „Other Course Settings“. Fill it with e.g. \`{"program\_code": "XX1", "institution": "edX"}\`
> 3. In a theme, use \`course.other\_course\_settings\` to access this value. E.g.
> \`\`\`
> \<%
> program\_code = course.other\_course\_settings.get('program\_code')
> ￼%\>
> ${program\_code}
> \`\`\`
> 4. Change \`ENABLE\_OTHER\_COURSE\_SETTINGS\` to false, and check that it hides the field
> 
> \*\*Reviewers\*\*
> \- \[x\] @bradenmacdonald 
> \- \[\] edX's
> 
> \*\*Author concerns\*\*: None
> \*\*Settings\*\*: None

> This adds a field to the “advanced settings” page of each course that allows the user to store additional metadata about the course, in a JSON dictionary, without requiring updating the platform code.
> 
> The idea is that this field can hold metadata like “ID of the course in external system”, course difficulty, or other instance-specific metadata about the course that needs to be available to the theme, CRM software, a marketing site, ecommerce, or other external systems.
> 
> The new field is protected by a feature flag which is False by default, so it won’t show up in Studio unless you enable the flag.

---

<div class="post-metadata">

**Author:** ![Andres.Aulasneo](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/andres.aulasneo/32/984_2.png) [@Andres.Aulasneo](https://discuss.openedx.org/u/Andres.Aulasneo)\
**Post date:** [May 27, 2022, 8:18am UTC](https://discuss.openedx.org/t/enabling-custom-course-settings/7337/3 "2022-05-27T08:18:37Z")

</div>

Hi Dave!  
Thanks for your response!  
I’ve seen that also in the docs… however I don’t know how to retrieve that information if I want to use it. Do you know where is it stored, and how to query it?

---

<div class="post-metadata">

**Author:** ![erickhgm](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/erickhgm/32/3538_2.png) [@erickhgm](https://discuss.openedx.org/u/erickhgm)\
**Post date:** [May 31, 2022, 2:03pm UTC](https://discuss.openedx.org/t/enabling-custom-course-settings/7337/4 "2022-05-31T14:03:23Z")

</div>

Hello everyone,

I’m using Tutor 13.2.2 e Open edX maple.3 and enable the feature `ENABLE_OTHER_COURSE_SETTINGS` in CMS. The idea is to have an integration using the REST API, but I couldn’t find an endpoint to get this information.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/openedx/original/2X/8/83a6f3d4d5dec1391363a1f1effb22a5aaf9d9f9.png)

I’ve tried all GET endpoints with a `course_id` as path param.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/openedx/original/2X/d/d566908d4bfa590c46762280140a195ac4d91922.png)

Ref.: [Add Course Metadata](https://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/en/latest/set_up_course/studio_add_course_information/creating_new_course.html#add-course-metadata)

---

<div class="post-metadata">

**Author:** ![dave](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/dave/32/263_2.png) [@dave](https://discuss.openedx.org/u/dave)\
**Post date:** [May 31, 2022, 6:47pm UTC](https://discuss.openedx.org/t/enabling-custom-course-settings/7337/5 "2022-05-31T18:47:33Z")

</div>

They should be available as a field for the root CourseBlock of a course in the [Course Blocks API](https://github.com/openedx/edx-platform/blob/db32ff2cdf678fa8edd12c9da76a76eef0478614/lms/djangoapps/course_api/blocks/views.py)

Edit: And probably also as part of the OLX export?

---

<div class="post-metadata">

**Author:** ![erickhgm](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/erickhgm/32/3538_2.png) [@erickhgm](https://discuss.openedx.org/u/erickhgm)\
**Post date:** [May 31, 2022, 9:07pm UTC](https://discuss.openedx.org/t/enabling-custom-course-settings/7337/6 "2022-05-31T21:07:06Z")

</div>

I got it!

1. [Getting access token](https://course-catalog-api-guide.readthedocs.io/en/latest/authentication/#getting-an-access-token): the path in the doc is wrong, the right is `/oauth2/access_token`, without v1 or v2.

2. [Enable feature ENABLE\_OTHER\_COURSE\_SETTINGS](https://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/en/latest/set_up_course/studio_add_course_information/creating_new_course.html#add-course-metadata)

3. [Enable COURSE\_BLOCKS\_API\_EXTRA\_FIELDS](https://github.com/openedx/edx-platform/blob/a27247d14d2b77234fd004988f96258e29d0d000/lms/envs/common.py#L1026)

4. [Getting course blocks](https://courses.edx.org/api-docs/): add query param: `requested_fields=other_course_settings`

---

<div class="post-metadata">

**Author:** ![Andres.Aulasneo](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/andres.aulasneo/32/984_2.png) [@Andres.Aulasneo](https://discuss.openedx.org/u/Andres.Aulasneo)\
**Post date:** [June 1, 2022, 2:49pm UTC](https://discuss.openedx.org/t/enabling-custom-course-settings/7337/7 "2022-06-01T14:49:21Z")

</div>

Great @erickhgm!  
Worked like charm! Only had to use double quotes to have the variables replaced.

I also found where is it persisted in MongoDB:  
It’s in the `modulestore.structures` collection, in the fields dict of the _course_ block type:

```auto
{
   "_id":"ObjectId(""nnnnnnn"")",
   "root":[
      "course",
      "course"
   ],
   ...
   "blocks":[
      {
         "fields":{
            "display_name":"Demonstration Course",
            ...,
            "other_course_settings":{
               "test_other_course_settings":"value"
            },
            "show_calculator":true,
            ...

```

Many thanks for your help!

---

<div class="post-metadata">

**Author:** ![resa](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/resa/32/6218_2.png) [@resa](https://discuss.openedx.org/u/resa)\
**Post date:** [November 28, 2023, 10:13am UTC](https://discuss.openedx.org/t/enabling-custom-course-settings/7337/8 "2023-11-28T10:13:36Z")

</div>

Hi Erick,

I tried this and it works in general. But, everytime I change the content of the other\_course\_settings field in an Open Edx Course (via the browser) the other\_course\_settings field disappears completely from the API result! In my experience for a few days, then it shows up with the new information. That’s very weird! Do you have a hint for me how to avoid this?

Thanks and best!

---

<div class="post-metadata">

**Author:** ![Andres.Aulasneo](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/andres.aulasneo/32/984_2.png) [@Andres.Aulasneo](https://discuss.openedx.org/u/Andres.Aulasneo)\
**Post date:** [November 30, 2023, 7:37pm UTC](https://discuss.openedx.org/t/enabling-custom-course-settings/7337/9 "2023-11-30T19:37:55Z")

</div>

Hi @resa,  
It’s strange… I’ve tested it and noticed a few seconds until the change is reflected in the API output but not days as you mention, or having the field disappeared. May be a cache issue?

---

<div class="post-metadata">

**Author:** ![resa](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/resa/32/6218_2.png) [@resa](https://discuss.openedx.org/u/resa)\
**Post date:** [December 1, 2023, 10:28am UTC](https://discuss.openedx.org/t/enabling-custom-course-settings/7337/10 "2023-12-01T10:28:50Z")

</div>

Hi Andres,

thanks a lot for your answer. That’s what we thought, too, at first. But, when I enter something in the “other course settings” field via the browser, the field disappears at once in the API result. If it would be a cache issue, I would see the old value for a while. We use the Version olive, maybe that could be a problem?

Thanks a lot again,  
Remon

---

<div class="post-metadata">

**Author:** ![Andres.Aulasneo](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/andres.aulasneo/32/984_2.png) [@Andres.Aulasneo](https://discuss.openedx.org/u/Andres.Aulasneo)\
**Post date:** [December 1, 2023, 1:04pm UTC](https://discuss.openedx.org/t/enabling-custom-course-settings/7337/11 "2023-12-01T13:04:30Z")

</div>

I’m running Olive.4. I tested again today with Postman and it worked fine.  
Make sure you have these settings:

```auto
"FEATURES": {
        "ENABLE_OTHER_COURSE_SETTINGS": True
}
"COURSE_BLOCKS_API_EXTRA_FIELDS": [
            ('course', 'other_course_settings')
],

```

---

<div class="post-metadata">

**Author:** ![resa](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/resa/32/6218_2.png) [@resa](https://discuss.openedx.org/u/resa)\
**Post date:** [December 8, 2023, 11:02am UTC](https://discuss.openedx.org/t/enabling-custom-course-settings/7337/12 "2023-12-08T11:02:24Z")

</div>

Thanks, Andres!

I will give it a try again when our palm Version is ready, although it should work with olive, too.

Best  
Remon

---

<div class="post-metadata">

**Author:** ![WillEVTdigital](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/willevtdigital/32/6667_2.png) [@WillEVTdigital](https://discuss.openedx.org/u/WillEVTdigital)\
**Post date:** [December 6, 2024, 6:08pm UTC](https://discuss.openedx.org/t/enabling-custom-course-settings/7337/13 "2024-12-06T18:08:28Z")

</div>

I came across this problem too. It looks to be a problem with the course block cache. I’m not sure whether the specific xblocks get deleted from the cache or there is an error as they’re updating; not something I can debug.

The solution for me was to force a cache update with

```auto
./manage.py lms generate_course_blocks --all_courses --force_update

```

---

<div class="post-metadata">

**Author:** ![WillEVTdigital](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/willevtdigital/32/6667_2.png) [@WillEVTdigital](https://discuss.openedx.org/u/WillEVTdigital)\
**Post date:** [December 9, 2024, 2:06pm UTC](https://discuss.openedx.org/t/enabling-custom-course-settings/7337/14 "2024-12-09T14:06:21Z")

</div>

This issue seems to be that `update_xblocks_cache` in `openedx/core/djangoapps/bookmarks/tasks.py` runs when an advanced setting is updated but it doesn’t add COURSE\_BLOCKS\_API\_EXTRA\_FIELDS, and removes it if it’s already in the cache.
