I've just spent a few hours baffled, before the holiday break I could create events against a particular person account (setting the Related To field) without issue; today, every time I saved the event the field would end up blank. Yes there are triggers on event, but no, they were not the cause — I checked this by putting some debug statements in the first line of the trigger, when using this particular record as the target then
WhatId (the API name for the field) would be
Having checked everything I could think of (I'd even gone as far as to check the Setup Audit Trail but to no avail), I called my colleague, explained what was happening and he also drew a blank. While on the phone it dawned on me that I was using the suggested item from the recently used drop down list to populate the field, shown in the screen shot below.
The Recently Used Items Drop Down
On an impulse I decided to use that to auto-complete the name, but then clicked on our friend the magnifying glass to open the lookup window proper, and selected the matched account presented there. This time when I saved the record, it saved correctly! Thinking this might have updated some cache somewhere I subsequently tried to the drop down again, but still it failed me.
Conclusion: if choosing something from a drop down recently used items list doesn't work, try using the actual lookup, though I suspect this could easily be related to the fact that this field is somewhat special in that it can lookup to objects of different types. It's the first time I've ever come across this problem, and it wouldn't surprise me if it was also the last, but if this helps anybody then it was worth me writing it up.
- Previous load of class failed: What?
- Curious Logic — A VisualForce Function Oddity
- Using Rerender to Render — One Solution for Headaches
* I might have just made this team up, but it has a nice ring to it.