You need to sign in to do that
Don't have an account?

How to prevent a web-to-case creation using a before insert trigger?
I am trying to find solution to this scenario:
User submits a web-to-case from a website.
A before insert trigger on Case object tries to do some validation on Trigger.New and in certain conditions has to prevent this case to be created.
I tried using addError() in trigger, but it works only when a CRM user is trying to create Case from within salesforce. It does not stop web-to-case scenario.
I must use a trigger, not simple validation rules as the validation involves many other objects.
I highly appreciate if anyone suggests a solution to this problem.
- regards,
- Venkat Penukonda.
User submits a web-to-case from a website.
A before insert trigger on Case object tries to do some validation on Trigger.New and in certain conditions has to prevent this case to be created.
I tried using addError() in trigger, but it works only when a CRM user is trying to create Case from within salesforce. It does not stop web-to-case scenario.
I must use a trigger, not simple validation rules as the validation involves many other objects.
I highly appreciate if anyone suggests a solution to this problem.
- regards,
- Venkat Penukonda.
regards,
Satish Kumar
In my scenario, user is submitting the case from a form on an external web site. Even with manually thrown exception, user will not see any thing wrong and case eventually gets created. My flow in before-insert case trigger is this:
Check for existing contact with matching user details (from web form).
1) If a matching contact exists, then link the contact to the case and proceed with creating case.
2) If contact does not exist, create a lead instead and do not create case.
So, I don't want to show any error to user anyway. All I need is a way to stop creating case in the second condition above.