Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
ShowAll Questionssorted byDate Posted
Vigneshwaran Loganathan

# Need to get Overlapping dates

Hi frnz, I need a logic for below situation in TRIGGER.

** VA is a parent object which has Cancellation as Child that has three records with 'start date' and 'end date' fields.
We need to calculate total days between Start date and End date in three records, then store it in VA.

** Now if those three records have any Overlapping days, we should not count that. For Example.......

Record1 - start date = jul 01 2015, end date = Jul 31 2015  = 31 days
Record2 - start date = Jul 10 2015, end date = Jul 20 2015  = 0 Dates were overlapped by the others
Record3 - start date = Jun 21 2014, end date = Jul 05 2015 = 10 days (Jun 21 - Jun 30, july 01 - july 05 overlapped by the others)
Record4 - start date = Jun 01 2014, end date = Jun 05 2014 = 5 days
total of 46 days

How to achieve this?
Thanks. :))

Ravi Gupta 15