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!

Comments

  • Hello, that's a great question: at the moment the importer does not handle this, but we could look at it. I wonder if @sandra's Data Admin module does this. Sandra? Thanks! Ross.
  • edited February 9
    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 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 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.
    admin
  • 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
    sandra
Sign In or Register to comment.