+ Start a Discussion

Using Schema.getGlobalDescribe() to update all fields in a record.

I wanted to use the Schema.getGlobalDescribe() in order to loop through all of the fields in Accounts and make an update to them.


Basically one of our clients have clients that need to upload data to their Salesforce.  Currently they upload this using the data loader (or something, i'm not quite sure but it doesn't matter) into a custom object, and then a batch gets run at night that converts this to Account.  This custom object matches Account on their system, which is slightly different from our clients.  


Basically I want to have the batch code to convert the custom object to an account, but whenever they add new fields to the custom object/account in the database we don't need to update the code.  The fields in the custom object and Account are generally similar, but there are a few special cases in which we can take care of manually.  Does anyone know how I might be able to access all of these fields, and then update them through a loop?  I have been looking into this, and it seems the only things I have found is getting the describe of the fields but not how to use this to access the field on the object.


Hopefully this makes sense and I would be glad to clarify anything.