Saturday, July 19, 2014

Invalid Id: An unexpected error has occurred. Your development organization has been notified

This obscure Salesforce error appears from time to time when fetching a custom url parameter in an extension controller class.

Id recordId;
recordId = ApexPages.currentPage().getParameters().get('rid');
if(rid!=null&&rid!=''){ //ERROR REPORTED ON THIS LINE

Resolution is to change the data type to String. There seem to be more implicit conversions from String to Id than the other way.

No comments: