UR12 – Upgrading Unsupported CodePosted by Blake Scarlavai on January 3, 2013 | Comments (0)
The reason these methods are considered unsupported is because they are intended to only be used internally by native CRM code. There is no guarantee these functions will stay the same through the different versions of CRM, and so using them can end up introducing bugs into your code when you upgrade to a newer version of CRM.
I recently discovered some unsupported code I was using that broke when I upgraded to UR12, and I thought it was worth sharing. I had written code to open the native CRM lookup dialog window (the window that opens when you click the magnifying glass on a lookup), and then do something with the selected record. Before UR12, the lookup window would return an object with an items collection, and that items collection would contain an array of the selected records.
However, I discovered in UR12 that this modal dialog (and, as far as I know, all modal dialogs) now return a JSON string that needs to be parsed into an object. You can see from the screen shot below that the selectedRecords value is now a string (as opposed to the previous screen shot, where selectedRecords is an object). By passing the string into JSON.parse, we can convert the string into the same object that we were using pre-UR12.
Thankfully, this is one instance where updating unsupported code was a fairly simple fix. As a general rule, you should never call unsupported code unless it’s a last resort. The more unsupported code you have, the more likely it is to break when upgrading CRM versions, especially when upgrading to UR12.