Spike: MODCFIELDS-21 - Getting familiar with User Data import to see how it can import custom fields

MODCFIELDS-21 - Getting issue details... STATUS

The goal of the spike is to investigate how user data is imported and how the import process can be extended to include custom fields.

1) Import process in mod-user-import: 

mod-user-import receives a POST "/user-import" request with collection of all imported users in a body.

Schema for users in mod-import-user matches schema in mod-users.

Each user in collection is updated or created with POST /users or PUT /users/{id}. 

2) Adding custom fields to mod-user-import: 

To pass custom fields to mod-users we just need to add following property to import schema:

"customFields" : {
"description": "Object that contains custom field",
"type": "object",
"additionalProperties": true

3)Adjusting custom field definitions

There is a requirement that we need to adjust custom field definition before importing users. For example if imported users contain unknown option for drop-down field, we need to add this option to the list of allowed options.

Proposed approaches:

1) Get all custom field definitions for users from mod-users, then update definitions with PUT requests. The logic for updating custom field definition has to be added to UserImportAPI.


  • Logic related to user import will be stored in mod-user-import


  • Import logic will be duplicated if later we need to import objects for other modules

2) Send flag "_extendDefinition" in POST /users and PUT /users/{id}. Flag "_extendDefinition" will change validation logic in mod-custom-fields.

If _extendDefinition is true then unknown options for select fields (single select dropdown, multi-select dropdown, radiobutton) will be added to custom field definition, instead of causing a validation error.


Following request will add option "new department" to custom field "department_1"

POST /users
  "customFields": {
    "_extendDefinition": true,
    "department_1": "new department"


  • Logic for processing "_extendDefinition" flag will be stored in mod-custom-fields, so it can be used in the future for importing objects to other modules.


  • It adds a special case and makes validation logic more complicated.