Skip to main content
1 of 2
gs650x
  • 2.7k
  • 14
  • 69
  • 106

SObjectException

As per my understanding, the below code should throw System.SObjectException: SObject row was retrieved via SOQL without querying the requested field, but instead it updated the account phone without any exception can someone please help me to understand the same?

public static void SObjectException1() {

    Account act = [SELECT ID FROM Account WHERE Name='GenePoint' LIMIT 1];
    act.phone = '1234567810';
    update act;
}
gs650x
  • 2.7k
  • 14
  • 69
  • 106