function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
JoshVHJoshVH 

IsGroupEvent always False

Can anyone tell me why the IsGroupEvent field on the Event object is always false in the After Insert/Update Trigger.  I am trying to perform logic only on events that are not group events.  This field is always false no matter what type of event I create.

trigger trgEvent on Event (after insert, after update) { if (Trigger.isAfter) { for(Event newRec : Trigger.new) { System.debug('Group Event: ' + newRec.isGroupEvent); //this is always false if (!newRec.isGroupEvent) //not working { } } } }

 

Best Answer chosen by Admin (Salesforce Developers) 
NirAdminNirAdmin

Hi JoshVH,

 

Did you get the soluution to this?

I am trying to populate a Owner's custom field in group activity through a trigger but surprisingly, the trigger doesn't catch the Invitee event records seperately. Instead, It populated the parent Event's owner field in all the events that are created for Invitees.

All Answers

NirAdminNirAdmin

Hi JoshVH,

 

Did you get the soluution to this?

I am trying to populate a Owner's custom field in group activity through a trigger but surprisingly, the trigger doesn't catch the Invitee event records seperately. Instead, It populated the parent Event's owner field in all the events that are created for Invitees.

This was selected as the best answer
JoshVHJoshVH

Sorry I should have posted.  I logged a case and it was confirmed a bug that the IsGroupEvent field value is invalid in the After Trigger.  The workaround is to create a custom field(do not put it on a page layout) to hold the value and populate it in the before trigger.  Then in the the after trigger use the custom field instead of the system field.  I have included a sample below.

 

trigger trgEvent on Event (before insert, after insert, after update) { if (Trigger.isBefore) { for(Event newRec : Trigger.new) { newRec.isGroupEvent__c = newRec.isGroupEvent; } } else if (Trigger.isAfter) { for(Event newRec : Trigger.new) { System.debug('Group Event: ' + newRec.isGroupEvent); //this is always false System.debug('Group Event: ' + newRec.isGroupEvent__c); //this is correct if (!newRec.isGroupEvent__c) //this works { } } } }