import Custom Fields to user

I have created a few custom fields for user, I can import basic data to users by the default import function or “Admin Data” module, but how can I import data to custom fields?

thanks!

Hello, that’s a great question: at the moment the importer does not handle this, but we could look at it. I wonder if @ross’s Data Admin module does this. Sandra? Thanks! Ross.

Hi tongng,

The Data Admin module can help with importing custom field data, with a little bit of setup. Because each school will have different custom fields you’ll need to create a Custom Import for your data. Luckily there’s no code to write, just a text file to edit.

I’ve attached a sample Import file to this post (zipped). This can be unzipped and placed in the /uploads/imports` folder (create the folder if it doesn’t exist). This is the default location, the exact folder is set in Data Admin Settings:

Once added you’ll see the new type of import show up in the list:

From here, you can edit the .yml file and you'll see a structure for the import. The only parts you'd need to change are the Example 1, Example 2, and Example 3 sections: you can edit and copy/paste these to add any number of fields to your import. The <code class="CodeInline">name: in this file should exactly match the Name field in Gibbon:
Eg:

For the most part the args: can be left unchanged (except the <code class="CodeInline">required: true part which can be set to false). Also the yml format is particular about the indentation, so use four spaces to indent, and any parts you add above fields:` should match the same indentation as the examples.

Hope this helps! Give a shout with any questions. It may sound like a lot of setup, but if you have a fair amount of custom fields to import it’s worth it.

Hola Sandra,

Do I have to serialize all custom fields in the last Custom Fields column? I prepared a .yml file using your template and I am trying to import the custom field data of my users with Data Admin module but it is being impossible =(

I wonder if the module is serializing the information for me.

Does this error tells something to you?

Thanks a lot!
Felipe

Hi Felipe,

Yep, it handles the serialization for you (and will merge new custom field data with any existing data). For the Custom Fields column, select [ Custom Value ] and then leave it blank. The updater will fill in the exact value as it runs. If that doesn’t work feel free to share the .yml for the custom import you’ve created and I’d be happy to take a look.

Hi,

Well, I debugged and reached to the conclusion that I was setting the column Custom Fields to [ Skip this column ] and such was ruining the serialization. I solved it by adding an empty row of Custom Fields to the .csv and it did the trick.

Thanks a lot for the prompt response! =D

What are the Example 1, Example 2, Example 3, Custom Fields fields?
I created a single custom short text field called Middle Name.
I put username in Person column. Where/which column do I put the Middle Name to update user profile? I put it in Example 1 column and changed column name to Middle Name? I am getting an error.

I’m trying to find Data Admin Settings

Took me 2 hours but I figured it out :cry:
resources → imports → usersCustomData.yml

Hi Tieku, one area of possible confusion is that the import functionality that used to be in the additional Data Admin module has since (as of v18 I believe) been moved into the Gibbon core. So, it is now under Admin > System Admin > Import From File.

Good job for working it out!