This Critical Update sounds like a welcome change, but it's not terribly specific. What does this Critical Update actually entail? Will we still be able to sniff hidden object types using Id.getSObjectType()? Will this somehow make it impossible to leak versioned API fields (e.g. LastViewedDate to a < 28.0 class)? This sounds like a great new feature if it eliminates bugs, but the wording seems a bit vague.
-
Seems like to be that way by reading this -- [This update also resolves rare, intermittent cases where undocumented object types are visible in Apex describe result methods or where version-specific schema details could be improperly reused.]– Jayant DasCommented Dec 17, 2018 at 20:43
-
2@JayantDas I'm still able to describe EmailTemp, which is undocumented, and why I asked. Apparently, it only fixes three specific Known Issues that I noticed after activation. Knowing exactly how it fixes things would be great to know.– sfdcfox ♦Commented Dec 17, 2018 at 20:53
-
Heads up we've had to defer this critical update to Summer '19: twitter.com/ca_peterson/status/1088232403775025153– ca_petersonCommented Jan 24, 2019 at 0:31
3 Answers
There's been a family of long-standing issues with edge cases in how the platform handles caching schema describe information under the covers. As Daniel mentioned, there are KIs that have gone unfixed where issues like initializing the describe for say, Account, at an old API version and then trying to access it with a newer one would (incorrectly) omit fields added between the old and new version (LastReferencedDate/LastViewedDate being a popular one that was impacted).
There are a number of other other ways this can manifest - if you've ever seen the ConferenceNumber type in your global describe? That's another category of issue where an internal-only SObject was accidentally made accessible through a describe being cached longer than it should have been. The mentioned EmailTemp
type isn't impacted by this type of caching issue, it more simply just lacks the check the prevents it from being org visible (but it is never API editable, so you can't do anything all that interesting with it anyways) - that's a wholly different type of issue that this CRUC doesn't change.
The Apex team did work for Spring '19 to refactor some of this caching, but if you have code/customizations that rely on this incorrect behavior this change would be considered breaking (despite bringing it in line with documented behavior). Rather than surprise you with this, we put it behind a critical update to allow testing and reporting any potential issues before it's mandatory.
Really, unless you have some sort of downright insane hack this shouldn't break anything for you - and if you do have that kind of hack it's likely not working consistently anyways. With that said, this is also something Hammer testing is poor at caching due to the particulars of the schema caching it runs with, so we particularly felt the need to be safe rather than sorry here without that safety net providing as much assurance as it normally does.
If you ever had support recommend creating a class with a name starting with "AAAA_" to ensure it's loaded first when compiling? This fixes you.
The wording is a bit vague, since trying to explain the intricacies of our schema definition and caching system is quite arcane, and some gymnastics are required to be able to even describe the type of issues this fixes, particularly to customers who aren't veteran Apex developers.
If you turn this on and see issues (other than bugs being fixed), we'd love to know more.
-
Okay, so the LastViewedDate apparently still kills queries and throw fun exceptions like "System.SObjectException: Field Contact.LastViewedDate is inaccessible in this context". This update apparently just fixes "under the cover" bugs, and not the more "obvious" bugs, like intentionally returning a field token from a supported version to an unsupported version, right?– sfdcfox ♦Commented Dec 18, 2018 at 5:33
-
I think I've got the gist of what class of bugs this fixes. I'm rather traditional; I avoid mixing versions as much as possible, and I try to bump up things as frequently as I can, and my tests usually catch behavior differences between versions, which explains why I've never run into these before. The wording was just vague enough that I thought it fixed a different class of issues than what was actually addressed.– sfdcfox ♦Commented Dec 18, 2018 at 5:41
-
So, issue like this success.salesforce.com/… going to be fixed?– AyubCommented Dec 18, 2018 at 6:02
-
@Ayub that bug should have been fixed as a versioned change in winter 19 independently of this critical update, I'll need to check when I'm at my desk why the KI status is wrong - it should show as fixed. Commented Dec 18, 2018 at 6:54
-
1@sfdcfox I wouldn't even call that a bug, passing a versioned field into an old version shouldn't work if we're versioning things right. That said, right - we didn't make changes to the apex runtime or describe types themselves, but rather to the systems we ask for details about org schema and expose to you in apex describe data. We didn't actually change the describe or token type bahvior, just the bahvior of the system that tells us which ones exist from your current viewpoint (api version, user license, etc) Commented Dec 18, 2018 at 6:59
I'd checked in with Chris Peterson about this, specifically around the concern that I wouldn't be able to use Id.getSObjectType()
. This critical update isn't about that altering that behavior.
Instead it is to fix known issues like Missing dependent object: Field: .LastViewedDate error occurs when Apex class with API version 28.0+ is used in VF with API version 27.0-. As you mentioned, this is where the LastViewedDate field in the describe map from and API V28.0 Apex class caused errors in a Visualforce page on v27.0 or lower that used the Apex class as it's controller.
-
1I've also reached out to Chris to help clarify this or add his own answer. Commented Dec 18, 2018 at 0:23
-
2I had a different long-standing issue in mind that I thought this fixed, but it doesn't. Combining the KIs with these answers filled in the blanks.– sfdcfox ♦Commented Dec 18, 2018 at 5:43
This knowledge article details the Known Issues that this critical update fixes:
Geo location fields throwing "No such column 'XXX__c' on entity 'XXXX__c' during deployment.