You need to sign in to do that
Don't have an account?

Salesforce trigger addError method
I'm creating an event management application that allows users to register for events. Each event is a 1-day event that can be comprised of x number of sessions that never overlap.
I have a master-detail relationship setup between the event table (master object) and the event session table (detail object). This allows x number of sessios for an event.
My question is how I can validate that the sessions never overlap.
In the event session table I have two date/time fields Start Time and End Time.
The only way I can think to validate if the sessions do not overlap is to use a trigger with the addError() method. However, how can I compare the times of each session for a specific event and determine if the sessions overlap?
Steps to do it
1)Write a trigger on session before insert
2)Find out all the existing sessions for this event which current session associated with
3)Loop over all the the Existing Sessions and validate dates
try this
This will not work for bulk data load handling
All Answers
Steps to do it
1)Write a trigger on session before insert
2)Find out all the existing sessions for this event which current session associated with
3)Loop over all the the Existing Sessions and validate dates
try this
This will not work for bulk data load handling
I am from non-coding background, know little bit of Salesforce Admin. But i want to become a Salesforce Developer. I am searching ways in internet but confused which one is right one. Can I become Apex, VF developer on my own????? Please please help. If possible give me call 9769540274
Also with my little understanding, just suggesting that I think we also need to put one more condition in IF statement to verify session overlap????
if( ( (((sNew.
StartDate__c
>
= sOld.
StartDate__c
&& sNew.
StartDate__c
<= sOld.
EndDate__c
)||(sNew.startDate__C <= sOld.startDate__c && sNew.EndDate__C>=sOld.startDate__c))