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
scrabscrab 

Get Object property value by its name

Hi, I'm Wondering if there is a possibility in Apex, to get the value of a particular object's property by its name (string)

f.i Im doing a lot of similar operations reading objects properties, I would like to put it thorough one fiction which will take a parameter called (fieldName) and will return the value of a field specified by this parameter.

 

Kind regards

PK

sebcossebcos

Hi,

it is possible to get values by name for objects.

Please review this documentation and in particular the get method:

http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#StartTopic=Content/apex_methods_system_sobject.htm?SearchType=Stem