I want to update the name field of newly inserted record with auto number field value.But auto number field is showing as null.But when I see the account record I could see the value of auto number field value on account page.
public PageReference MakeAnonymous(){
Account acc = new Account(Name='Anon');
insert acc;
system.debug('account number..'+ acc.Auto_Number__c);
acc.Name = acc.Name + '-'+ acc.Auto_Number__c;
update acc;
}
Best Answer
The value of auto_number__c is set when you insert the record. You would need to query the database to see what the value is.
For example