2 added 466 characters in body
source | link

If you already have an Id value, you do not have to do a query to update the value. Instead you construct an instance using the Id you have and set the field value you need and then pass that object to the update operation:

update new A__c(Id = '474xxxxxxx', F__c = 'Some Value');

To set picklist fields, you can just assign the string value.

On the subject of what your code does when extra fields are added, it is possible using describe calls and the map-life syntax that the base class of all SObject types supports, to write code that automatically adapts to the extra fields. But that is harder to get right than the more normal code that just adds code for each extra field.

If you already have an Id value, you do not have to do a query to update the value. Instead you construct an instance using the Id you have and set the field value you need and then pass that object to the update operation:

update new A__c(Id = '474xxxxxxx', F__c = 'Some Value');

To set picklist fields, you can just assign the string value.

If you already have an Id value, you do not have to do a query to update the value. Instead you construct an instance using the Id you have and set the field value you need and then pass that object to the update operation:

update new A__c(Id = '474xxxxxxx', F__c = 'Some Value');

To set picklist fields, you can just assign the string value.

On the subject of what your code does when extra fields are added, it is possible using describe calls and the map-life syntax that the base class of all SObject types supports, to write code that automatically adapts to the extra fields. But that is harder to get right than the more normal code that just adds code for each extra field.

1
source | link

If you already have an Id value, you do not have to do a query to update the value. Instead you construct an instance using the Id you have and set the field value you need and then pass that object to the update operation:

update new A__c(Id = '474xxxxxxx', F__c = 'Some Value');

To set picklist fields, you can just assign the string value.