• Vijay Zutshi 3
  • NEWBIE
  • 0 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 0
    Replies
I am doing a trailhead mix for Financial Service Cloud. In one of the modules it is asking to load Wealth Management app as most of the course work is based on that.  I have also downloaded the Developer Edition with Financial Services Cloud enabled but still I am not able to see that app. Kindly advise as I am stuck and cannot proceed further. Thanks 
Thanks
Vijay Zutshi
Hi,

I have 3 custome objects
1. Session - Fileds(Date, Description, Level, Session Name

2. Session Speaker (Junction object) has following fields:-
* Session - Master detail(Session)
* Session Speaker Number - auto number
* Speaker - Master Detail(Speaker)

3. Speaker- fields (Owner and Speaker number)

I have written a trigger to not allowing double bookings of Sessions but it is not working properly. The conflict variable does not pull up any record that are conflicting. My trigger is as follows:-

//Trigger to detect double booking
//for the session speaker
trigger rejectDoubleBooking on Session_Speaker__c (before insert, before update) {
    LIST<Session_Speaker__c> speakers = new LIST<Session_Speaker__c>();
    SET<ID> speakerId = new SET<ID>();
    LIST<Session__c> allSessions = new LIST<session__c>();    
    for(Session_Speaker__c sessionSpeaker : trigger.new) {
    speakerId.add(sessionSpeaker.Session__c);
        speakers.add(sessionSpeaker);
        system.debug('speakerId' + speakerId);
    system.debug('sessionspeaker' + sessionSpeaker); 
        system.debug('speakers' + speakers);
    }
    LIST<Session__c> ses = [SELECT ID, Session_Date__c 
                            FROM Session__c
                            WHERE Id =:speakerId];
   system.debug('ses' + ses); 
    
    LIST<Session_Speaker__c> conflicts = [SELECT Id
                                             FROM Session_Speaker__c
                                            WHERE Speaker__c =:speakerId
                                          AND Session__r.Session_Date__c =:ses];
    system.debug('conflicts' + conflicts);
       
         //If conflicts exist, add an error (reject the database operation)
            if(!conflicts.isEmpty()){
            //sessionSpeaker.addError('The speaker is already booked at that time');           
        }
    //}

}

Please help as I am stuck.

Thanks
Vijay