Web services

core_user_create_users custom fields not being set

core_user_create_users custom fields not being set

I am able to create a user using this string.


My custom fields are not being set!!  Anyone see anything wrong with those last two parameters.

Average of ratings: -
Picture of Dorel Manolescu
Re: core_user_create_users custom fields not being set
Plugin developers


Which moodle version are you using. It works for me with latest 3.5 moodle

Looking in the code there is support for custom fields in the web-service:


// Custom fields.
if (!empty($user['customfields'])) {
foreach ($user['customfields'] as $customfield) {
// Profile_save_data() saves profile file it's expecting a user with the correct id,
// and custom field to be named profile_field_"shortname".
$user["profile_field_".$customfield['type']] = $customfield['value'];
profile_save_data((object) $user);


Just check that you have the correct syntax there. Please find attached a screen-shot with a postman request.

Any other questions let us know.


Average of ratings: -