• Kim Alt
  • NEWBIE
  • 0 Points
  • Member since 2014
  • Sr. Salesforce Admin
  • eightCloud

  • Chatter
    Feed
  • 0
    Best Answers
  • 5
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 0
    Replies
The code in the Trailhead Project called "Creating Apex Triggers" is incorrect in lines 4 and 10. 
Here is the existing code:
03     //collect ID's to reduce data calls
04     List<Id> speakerIds = new List();  
05     Map<Id,DateTime> requested_bookings = new Map<Id,DateTime>();
06     
07     //get all speakers related to the trigger
08     //set booking map with ids to fill later
09     for(Session_Speaker__c newItem : trigger.new) {
10         requested_bookings.put(newItem.Session__c,null); /
11         speakerIds.add(newItem.Speaker__c);

Here is the revised code:
03     //collect ID's to reduce data calls
04     List<Id> speakerIds = new List<Id>();  
05     Map<Id,DateTime> requested_bookings = new Map<Id,DateTime>();
06     
07     //get all speakers related to the trigger
08     //set booking map with ids to fill later
09     for(Session_Speaker__c newItem : trigger.new) {
10         requested_bookings.put(newItem.Session__c,null);
11         speakerIds.add(newItem.Speaker__c);

Notice there is no / at the end of line 10.  Thanks to my super-dev guy Kyle for helping me with this!
We have 6 inactive Triggers in our org.  When I run a Code Coverage test in the Developer Console, they show up with 0% coverage.  Are they counting against our 75% minimum?  If so, would the best answer be to comment out the lines (assuming we don't want to delete the code entirely)?
The code in the Trailhead Project called "Creating Apex Triggers" is incorrect in lines 4 and 10. 
Here is the existing code:
03     //collect ID's to reduce data calls
04     List<Id> speakerIds = new List();  
05     Map<Id,DateTime> requested_bookings = new Map<Id,DateTime>();
06     
07     //get all speakers related to the trigger
08     //set booking map with ids to fill later
09     for(Session_Speaker__c newItem : trigger.new) {
10         requested_bookings.put(newItem.Session__c,null); /
11         speakerIds.add(newItem.Speaker__c);

Here is the revised code:
03     //collect ID's to reduce data calls
04     List<Id> speakerIds = new List<Id>();  
05     Map<Id,DateTime> requested_bookings = new Map<Id,DateTime>();
06     
07     //get all speakers related to the trigger
08     //set booking map with ids to fill later
09     for(Session_Speaker__c newItem : trigger.new) {
10         requested_bookings.put(newItem.Session__c,null);
11         speakerIds.add(newItem.Speaker__c);

Notice there is no / at the end of line 10.  Thanks to my super-dev guy Kyle for helping me with this!