Import custom fields of user with import_scripts Ruby

I’ve created the DrupalID field from user fields and now I want to import data into this

create_users(@users_json) do |u|
#        id: u["uid"],
#        name: u["name"],
#        email: u["mail"],#
#       custom_fields: {
#          '1':u["uid"],
#          'DrupalID':u["uid"]
#        },

        id: 2037,
        name: "Test 7",
        email: "",
        custom_fields: {


Is this a question is an answer? Are you saying that your code works?

Yes code works but not for custom fields
I want to update custom fields also

Search the other importer scripts for “custom_field”. I’m sure there are examples; I’m fairly certain I’ve done it before.

1 Like

Yes I checked but we haven’t any example provided of JSON file and field name (what we needs to use)

Also i try to import with CSV, but I have same case (Example files missing)

Just find any script that imports custom user fields and add that to your script

1 Like

I tried also custom_fields.csv from
Field name DrupalID

id,user_field_1,DrupalID,Drupal ID,custom_field_DrupalID,drupalid


It’s not working, showing field blank

Looks like should work, but you have to define the ENV seen in

1 Like