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
dmchengdmcheng 

Web-to-Case and Before Insert trigger: Origin not set?

Hello.  It looks like the value of Origin field in a Web-To-Case is not set until after the case is inserted.  Is that true?  I am writing Before Insert trigger code that should only run for web-to-case, but when I include an if statement for Origin == 'Web', my code doesn't run.  It's only when I comment out the if statement that code runs.

 

If that is case, is there any other standard way to determine a web-to-case?  Or do I have to create a custom field and link it to a hidden field on the web form?

 

Thanks

David

BrendaFlynnBrendaFlynn

Have you tried printing out the value of the origin to the debug log? That might show what is being returned, exactly, so you can verify whether your == 'Web' is correct. Maybe it's case sensitive, or maybe it's 'website'. I'd first verify that the value of the origin field is exactly what you think it is.

 

You could also try updating both sides to be in the same case, and making sure you're trimming whitespace.