1

Is it possible to only update one field?

List<Account> accountsFromSF = [SELECT Email_3__c from Account LIMIT 50];
for (Account acc : accountsFromSF){
    acc.Email_3__c = 'test@gmail.com';
}
update accountsFromSF;

I have required fields and some validation rules for some fields..

2 Answers 2

3

If a validation would prevent saving the record, you cannot save the record, even just to update one field. You would need to fix the data or disable the rules in Setup beforehand.

2

Yes it is possible to update only one field if all the data meets the defined conditions. But sometime While updating the field if the particular record, missing the required field then error will occur while updating.

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.