function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
jheuveljheuvel 

Instantiate specific sObject from generic code

Hi all,

i'm building an integration on the API using the WSDL from my org.

I'm trying to create a generic class for several (standard and custom) objects, so I can generalize the ETL proces. I'm hoping to make this as resusable as possible.

 

Struggling to find a solution for the following:

 

Would it be possible to instatiate an sObject from a string with the object name, via the API?

Something like:

sObject obj = new binding.describeSObjects(string sObjectType[] ); (i know this is not the way to do it...)

 

Next, would i then be able to use the object's specific fieldnames from the sObject?

 

Help would be very welcome!

Thanks,

Jochem

SuperfellSuperfell

You should look at the partner WSDL/API, it makes these generic/metadata driven approaches easier.

Abhinav GuptaAbhinav Gupta

Their is a framework already for that named Tolerado. Here is the wiki page that shows, how you can do something like this

 

http://code.google.com/p/tolerado-sfdc-wsc-apis/wiki/CodeSamplesToleradoSObject