You need to sign in to do that
Don't have an account?
jaw999
Relating Contacts from Invitees via Trigger
I want to dumb down the multi person calendar events in Salesforce so a Salesperson can go to the invitees on the bottom and just enter all the people - users and contacts in one place.
If one adds contacts there, the event does not show in the Contact's related list. The EventRelation field IsParent defaults to FALSE, but updating it to TRUE makes this appear in the Contact's related lists.
Are there other considerations I am missing?
My trigger is below. One thing I can't do yet is limit my query to related contacts. Can't use LIKE '003%' in the id query.
Also, it doesn't seem to be updating. Am I missing the update...
If one adds contacts there, the event does not show in the Contact's related list. The EventRelation field IsParent defaults to FALSE, but updating it to TRUE makes this appear in the Contact's related lists.
Are there other considerations I am missing?
My trigger is below. One thing I can't do yet is limit my query to related contacts. Can't use LIKE '003%' in the id query.
Also, it doesn't seem to be updating. Am I missing the update...
trigger EventAttendeeCollector2 on Event (after insert, after update) { For (Event EVT:trigger.new){ List <eventRelation> Erelates =[select RelationId from eventRelation where eventID=: EVT.id and IsInvitee = TRUE and IsParent=False]; system.debug('ERELATES______________________________________'+ERELATES); for (eventRelation Link:Erelates){ link.isparent=true; } } }
As salesforce best practices does not allow us to use SOQL inside the for loop so i have modified your trigger code and you are also missing an Update statement.
Please replace your trigger code from below code :
Let me know if you have any issues with this.
Thanks,
Abhishek
Do you know how I'd filter out to only query Contact EventRelation and not Users?
Can you please explain it more clearly ?
So isParent = True. But when I do an export of the EventRelations using the Data Loader IsParent=false. Is something not being committed?
So please go through the debug log from top to bottom and check which triggers are running after this debug statement.
Your Event Relation is being updated once againg during the same context tht is why it is showing still false.
Please go through your debug log once again.
Abhishek.
Gmail : abhishek.bansal@metacube.com
The solution can not be figure out from conversation over here,
So if it is possible for you than please contact me personally.
Thanks,
Abhishek
But we're seeing something stop it.
Trying it with their LIMIT of 1 doesn't make a difference.
Trigger:
One error on code - loop variable must be type Id ?