+ Start a Discussion

Start date "n" after close date "n-1"

Hi everybody,
I created two custom objects in master-detail relationship: "Operation"(master) and "Activity" (detail).
In activity, among the others, there are two fields: "start date" and "close date". I need a way to prevent that "start date" of "activity n" can't be set before "close date" of "acitivity n-1".
I tried with validation rules and creating two different record types for activity but I didn't get it.
Do you have any idea?

Many Thanks!
Chandra PrakashChandra Prakash
Hello ,

Please try this

IF( End_Date__c <=  Start_Date__c , true, false)

Hi Chandra,
thanks for your answer.
The problem is that in this way I can't create an Activity with Start Date < End Date...and that's not possible!
I should indicate that the "End Date" belongs to the previous Activity respect of the Activity (with the new "Start Date") I'm creating.
Tell me if I didn't explain it well and if you need more details.
Many thanks

Unless something changed in a recent update (I have been away for a few months) detail objects cannot reference sibling objects in formulas and, as a result, workflows and validations rules will not be possible here.

It could be done in a trigger. Is using APEX an option for you?

Hi MellowRen,
many thanks for your interest but actually I found a solution!
I created I a validation rule to stop users creating new activities where the StartDate comes before the LastEndDate (a MAX roll up on the "End Date" fields):

StartDate__c <= Operation__r.LatestEndDate__c
Operation__r.LatestEndDate__c <> EndDate__c

and it works great!!

Bye and thanks again,