1

I have a string which is a name of sObject. I converted the string to a sObject. Now I want to get the fields from the object. When I try to access the fields from sobject (contact) i am getting error

Field expression not allowed for SObject

I want to get the fields from the sObject how it is possible.

1
  • Can you post the code use used when trying to access the fields for your SObject? Commented Apr 7, 2016 at 9:20

1 Answer 1

3

Yes when you use Sobject.FieldAPIName then only you receive error

Field expression not allowed for SObject

Because you cant access the value this way.

Solution

You need to use SObject get() method to get the value... Sobject Methods

like

Sobject.get('FieldAPIName')  

This will give you the value of that Field i.e. FieldAPIName..

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .