Date not older than another date field

I have 2 date field in my opportunties - 

Expected Close Date

and

Start Date

I would like that you cant save the opportunity if Start date is the same or older than Expected Close Date. How do I write that formula?

Parents
  • Hi Lena,

    An alternative solution by using native functionality in Sugar, is to create a custom text field in the Opportunities module. The field should be flagged as required and the calculation would look similar to this:

    ifElse(or(greaterThan(daysUntil($start_date_c),daysUntil($date_closed)),equal(daysUntil($start_date_c),daysUntil($date_closed))),"Start date valid","")

    By marking the field required and calculated, that means it will only have a value in the field if the two date fields meet your requirements. Otherwise, the field will be empty and prevent the record from being saved. The downside to this approach is that the error message delivered to the user will not be obvious on what is wrong when the start date is earlier than the close date. Below is a screenshot showing the error message a user receives when the 'Date Validator' field does not pass the required check:

    If you are looking for a more helpful error message when the start date is not valid, Yury's approach would be more suitable.

Reply
  • Hi Lena,

    An alternative solution by using native functionality in Sugar, is to create a custom text field in the Opportunities module. The field should be flagged as required and the calculation would look similar to this:

    ifElse(or(greaterThan(daysUntil($start_date_c),daysUntil($date_closed)),equal(daysUntil($start_date_c),daysUntil($date_closed))),"Start date valid","")

    By marking the field required and calculated, that means it will only have a value in the field if the two date fields meet your requirements. Otherwise, the field will be empty and prevent the record from being saved. The downside to this approach is that the error message delivered to the user will not be obvious on what is wrong when the start date is earlier than the close date. Below is a screenshot showing the error message a user receives when the 'Date Validator' field does not pass the required check:

    If you are looking for a more helpful error message when the start date is not valid, Yury's approach would be more suitable.

Children
No Data