LN_test
                (LN test)
              
                
                
              
                  
                  
              1
              
             
            
              

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: "test7@gmail.com",
        custom_fields: {
          '1':'test',
          'DrupalID':"test"
        },
        created_at: Time.zone.at(u["created"].to_i),
      }
             
            
              
              
              
            
            
           
          
            
              
                pfaffman
                (Jay Pfaffman)
              
              
                  
                  
              2
              
             
            
              Is this a question is an answer? Are you saying that your code works?
             
            
              
              
              
            
            
           
          
            
              
                LN_test
                (LN test)
              
              
                  
                  
              3
              
             
            
              Yes code works but not for custom fields
I want to update custom fields also
             
            
              
              
              
            
            
           
          
            
              
                pfaffman
                (Jay Pfaffman)
              
              
                  
                  
              4
              
             
            
              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
            
            
           
          
            
              
                LN_test
                (LN test)
              
              
                  
                  
              5
              
             
            
              Yes I checked but we haven’t any example provided of JSON file and field name (what we needs to use)
             
            
              
              
              
            
            
           
          
            
              
                LN_test
                (LN test)
              
              
                  
                  
              6
              
             
            
              Also i try to import with CSV, but I have same case (Example files missing)
             
            
              
              
              
            
            
           
          
            
              
                pfaffman
                (Jay Pfaffman)
              
              
                  
                  
              7
              
             
            
              Just find any script that imports custom user fields and add that to your script
             
            
              
              
              1 Like
            
            
           
          
            
              
                LN_test
                (LN test)
              
                
              
                  
                  
              8
              
             
            
              I tried also custom_fields.csv from https://github.com/discourse/discourse/blob/main/script/import_scripts/csv_importer.rb
Field name DrupalID
id,user_field_1,DrupalID,Drupal ID,custom_field_DrupalID,drupalid
23456,John,John,Doe,example,johndoe
23457,Jane,Jane,Smith,example1,janesmith

It’s not working, showing field blank
             
            
              
              
              
            
            
           
          
            
              
                pfaffman
                (Jay Pfaffman)
              
              
                  
                  
              9
              
             
            
            
              
              
              1 Like