How could I go about updating a field value of an object?
For example, I have an object of type A
and its id
is 474xxxxxxx
. The object of type A
have a field f
which type is a Picklist
. I have a string representation of a picklist value I would like to set.
I could retrieve the values of my object by id
using SOQL in Apex. Construct a new object of type A
from the values and while doing that set the desired value for the field f
.
But here are two problems: now every time someone will add a new field to the A
type that someone should go to my code and retrieve values of those added fields and the second problem how could I set the value for the Picklist
type using a string?
A simple implementation example would be very helpful in the case, since I was not able to find one on the Internet.