You need to sign in to do that
Don't have an account?
Sanchivan Sivadasan
How do you prevent Shift Time overlap?
Hi All,
I have an object called ShiftConfig with the following:
StartTime
EndTime
Enabled__c
Sunday__c
Monday__c
Tuesday__c
Wednesday__c
Thursday__c
Friday__c
Saturday__c
So for each weekday we can have multiple shifts. For an example, we can have the following:
Tuesday:
StartTime EndTime
Shift1: 0600 - 1200
Shift2: 1200 - 1800
Shift3: 1800 - 0600
We need a validation so the times do not overlap. So we need to prevent something like this:
Tuesday:
StartTime EndTime
Shift1: 0600 - 1200
Shift2: 1100 - 1800
Shift3: 1500 - 0600
How can I do this in a trigger?
Thanks.
Sanch.
I have an object called ShiftConfig with the following:
StartTime
EndTime
Enabled__c
Sunday__c
Monday__c
Tuesday__c
Wednesday__c
Thursday__c
Friday__c
Saturday__c
So for each weekday we can have multiple shifts. For an example, we can have the following:
Tuesday:
StartTime EndTime
Shift1: 0600 - 1200
Shift2: 1200 - 1800
Shift3: 1800 - 0600
We need a validation so the times do not overlap. So we need to prevent something like this:
Tuesday:
StartTime EndTime
Shift1: 0600 - 1200
Shift2: 1100 - 1800
Shift3: 1500 - 0600
How can I do this in a trigger?
Thanks.
Sanch.
Let's say 10th March will have 3 records : Shift1: 0600 - 1200
Shift2: 1200 - 1800
Shift3: 1800 - 0600
Could you please give a sample of how you wish to log the records in this object
if we go by the date saying single date have 3 shift config records - we can then create a trigger to compare the start and end time entered with the ones existing for that particular date and so avoid overlaps.
I'm hoping I got your requirement correctly, if not - pls elaborate..