You need to sign in to do that
Don't have an account?
toro
Validation rule on Opportunity for Opportunity product data
I need to setup validation rule on close date in opportunity.
What I'm trying to do is alert user if they try to change closed date after ship date in opportunity product. (ship date is custom field in opportunity product)
I could not find a way to compare ship date in opportunity product to close date.
Also we can have more than one product for an opportunity.
Does anyone can tell me how to do this?
Ah, I got it working.
I need to add "list <OpportunityLineItem>" .
All Answers
I believe you will have to write a trigger that:
Gets the ship date for the specific product in Oportunity product
then compares the value of the close date to that ship date
if the close date is > ship date then adderror('Your message here)
this will prevent the entry of a close date > ship date.
This is my very first trigger.
I would appreciated if you (or somebody) could help me how to write the trigger code...
This is what I started, but does not look like it's working.
Thanks.
Try this:
This IS NOT Bulkified and WILL Not work with bulk Opportunity updates (Think unable to update Opp via dataloader or mass update)
Also, this will check ALL Opp Line Items and not check just the ones you are looking for if there could be multiple cship dates and different products.
Thank you for your post.
When I try it, I got error, " Error: Compile Error: unexpected token: ';' at line 6 column 53".
Ah, I got it working.
I need to add "list <OpportunityLineItem>" .