
Prevent Salesforce Custom Metadata Text Field Truncation
While working on my Email Invalidation Tool, I ran into Salesforce truncating Custom Metadata text fields at 512 characters. I struggled at first to understand why the static methods – my goto with Custom Metadata – were resulting in broken records. Turns out the solution is simple – use SOQL. The Problem: Salesforce Truncates Custom Metadata Text Fields When loading Salesforce Custom Metadata records using the static methods getInstance() or getAll() long strings are truncated at 511 characters (probably 512 bytes actually, I am not sure what happens if you have multi-byte characters in the string character 512 is probably a null terminator). ...