You need to sign in to do that
Don't have an account?
Jay Sanborn
Validate Product Exists on Opportunity when Checkbox Field is True - Help!
Hello
I am trying to write a validation rule on a save or update to an opportunity that checks that the Opportunity Contains a Product (Product Type = Configuration) if the Config_Required Checkbox field is TRUE.
I have been trying to write a trigger but cannot get it to work. Any thought or example would be greatly appreciated.
Thank You
Jay
I think your requirement isn't something that you can do with a validation rule and a trigger is going to be your best option. This solution is assuming that the trigger needs to only fire when the opportunity is updated. It relies on the opportunity existing since a new opportunity won't have any line items associated to it so users should never be able to set the config required flag on insert. That could be done with a validation rule easily.
To check when an opportunity already exists I put together the following code. I did this purely from my head and have not tested it so I can't say that it works but it should give you an idea of what you need to to do accomplish this task.
Hope this helps as a staring point.