function readOnly(count){ }
Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
How to create events on calendar for custom objects
How to add default invitees whenver an event is created
Steve,
I was recently interested in doing something similar. Take a look at the code below.
I'm still working on a class to test this so when I have 100% coverage I will update.
trigger test_custom_calendar on Testable__c (after insert, after update) { //new list of events list<Event> ev = new list<Event>(); for(Testable__c t : trigger.new){ //if new record, populate these fields if(trigger.isInsert){ Event e = new Event(); e.StartDateTime = t.Start_Time__c; e.EndDateTime = t.End_Time__c; e.Agent__c = t.Agents__c; e.OwnerId = UserInfo.getUserId(); e.WhatId = t.Id; e.default_invitee_one__c = 'Peter Tosh'; e.default_invitee_two__c = 'Gregory Isaacs'; //add new rows ev.add(e); } //if parent is updated, delete original event and create new if(trigger.isUpdate){ Event dead_events = [SELECT WhatId, StartDateTime, EndDateTime FROM Event WHERE WhatId IN : trigger.old]; delete dead_events; Event e = new Event(); e.StartDateTime = t.Start_Time__c; e.EndDateTime = t.End_Time__c; e.Agent__c = t.Agents__c; e.OwnerId = UserInfo.getUserId(); e.WhatId = t.Id; e.default_invitee_one__c = 'Peter Tosh'; e.default_invitee_two__c = 'Gregory Isaacs'; //add new rows ev.add(e); } } //insert new list insert ev; }
-Natty
I got it.I deployed into production.I got llike 95% code coverage sending events on calendar to multiple people one time
Natty or Steve- I'm trying to do something similar and I think I can adapt your trigger code. Could you share your test class with us? Thanks- HGriff
Steve,
I was recently interested in doing something similar. Take a look at the code below.
I'm still working on a class to test this so when I have 100% coverage I will update.
-Natty
I got it.I deployed into production.I got llike 95% code coverage sending events on calendar to multiple people one time
Natty or Steve- I'm trying to do something similar and I think I can adapt your trigger code. Could you share your test class with us? Thanks- HGriff