Custom course fields in upload courses Tool (csv file)

Custom course fields in upload courses Tool (csv file)

by Ruth Bor -
Number of replies: 2

Hi everybody.

I am trying to upload new courses using the upload course tool with a csv file. The csv file affects all uploaded fields except for the custom fields. the shortname I use for the custom fields is: customfield_xxx xxx=shortname of custom field I created. I have tried with text area and short text, with default value and without, with the required function and without.

I saw that the issue of this problem MDL-66135 is marked as closed and as I understand is part of Moodle now (my version is the latest 3.11.4.

Is the shortaname I am using for the custom field is correct? what could be the problem?

Average of ratings: -
In reply to Ruth Bor

Re: Custom course fields in upload courses Tool (csv file)

by Randy Thornton -
Picture of Documentation writers
Ruth

Yes, that is correct. The field header has the form customfield_shortname where the shortname is that of the custom field you have defined already. So, customfield_session or customfield_edulevel or whatever you have.

When you do the file upload, on the screen for the course when you do the Preview, do all the field you have show up in the "Default values for 'Other fields'" or whatever other course custom field categories you have? (See example in attached screenshot where I have five fields, one of each type.)

A couple of common issues with it I have seen are:

1) The course is a duplicate or other error

If the course already exists or there is some other error with the upload file, like a missing field, then the Result field at the top of the Preview screen will be marked with a red cross. There could be any number of issues here that are not related to the custom fields at all. (See screenshot attached.)

2) The custom fields are not the same

There could be a typo in the header in the csv field. That's common. If a field is in the file but not already created on the site, the upload will just ignore it totally. If you have a field that is defined in the site but that is not listed in the upload, it will either a) use the default for the field if there is one defined, or b) if there is no default value, it will show that field to you on the screen to fill in some data if you wish.





Attachment screenshot_10851.jpg
Attachment screenshot_10852.jpg
In reply to Randy Thornton

Re: Custom course fields in upload courses Tool (csv file)

by Ruth Bor -
Hi Randy and thanks for answering.
Did all and resolved the problem. Somehow there was a blankspace between underscore and field name...