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
thinkscientistthinkscientist 

validation rule needed for opportunity fields

Hi there,

 

I don't know whether I am using the right approach for what i'm trying to achieve here so let me explain the context and then ask whether the approach i'm trying to take is the right one..

 

So basically what I'm trying to do is set up opportunities for selling time based slots of a product. So for example I have product A and Product b.

 

Now you can't buy more than one of either product only rent them from a start date to an end date..

 

So what I want to do is set the start and end date in my opportunity but then have a validation rule that triggers when you try to save the opportunity. 

 

So let's say that the opportunity has moved to a stage where the probability is greater than 50% then if there is another opportunity for that product with dates that fall inbetween the start and end dates of that opportunity the validation rule triggers and the user can't save the object. i.e. product A is already booked out. 

 

Is that the right way to go about doing this and if so, how could i write a formula for the validation rule that could look up those dates in other open opportunities either by stage or probability

 

Thanks

 

 

_Prasu__Prasu_
You will also need to check it from account. As same product may be rented by different account?

You would not be able to achieve this from validation rule. Trigger can.
thinkscientistthinkscientist

Thanks for the response.

 

Am I trying to do this in the right way, I am trying to find other people who may have come across doing something like this and they mention the use of products and assets?