I have a scenario in which I need to know if a SObject has been loaded with some fields I am about to update. It has been loaded in another code layer, I just get it in input of my method. I am obliged to reload the object to make sure I don't overwrite not loaded fields with a persisted value. Is that correct?
I was hoping
getPopulatedFieldsAsMap() would help me identify which field must be reloaded. The problem is null fields are not in the map. I cannot tell the difference between "not loaded" and "null", which forces me to reload the object anyway. Getting null values for null fields would help a lot in this case.
What do you think? Is it worth asking for an enhancement? I'm not very experienced as an Apex dev, so my design could be totally wrong... Or maybe there is a way to do this I haven't found.