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.

  • Can you post the code use used when trying to access the fields for your SObject? – Marc Zaharescu Apr 7 '16 at 9:20
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..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.