function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Scott.MScott.M 

Visualforce Case From

I have a visualforce case form that I want to use to allow users on a website to submit cases from. The problem is that it appears to force a contact id even if I populate the supplied field. I'm using dynamic dml but that shouldn't make a difference:

 

The error is:

No selected contact

 

 

Scott.MScott.M

So it turns out that if you use setOptions instead of passing the email header in Database.insert() you get the error, if you pass the email header in the insert call it works fine.. very strange

 

I was wrong Database.insert() doesn't throw exceptions on errors so the error was still happening. The culprit is the

triggerOtherEmail flag. For some reason if this is set to true the case form will start throwing the Not Contact Selected error. Changing this to false fixes the issue. I don't really understand why this would be though. I would expect it to ignore cases where no contact is selected or created instead of throwing an error.