You need to sign in to do that
Don't have an account?
Nishan
Events on Custom object records
Hi Everyone,
How can I add an event for a current custom object (not just a calender event) ?
trigger SiteEvent on Site__c (after insert, after update) { List<Event> eventList = new List<Event>(); for(Site__c site : Trigger.new) { if(site.Date_Of_Next_Level_Of_Construction__c != null) { Event event = new Event(); event.Subject = site.Name; event.StartDateTime = site.Date_Of_Next_Level_Of_Construction__c; event.EndDateTime = site.Date_Of_Next_Level_Of_Construction__c; event.OwnerId = UserInfo.getUserId(); event.IsReminderSet = true; event.ReminderDateTime = site.Date_Of_Next_Level_Of_Construction__c; eventList.add(event); } } if(eventList.size()>0) { insert eventList; } }
What I want is to insert this event in the current site record itself(trigger.new)
Thanks in advance
Please put this code:
event.WhatId = site.Id;
All Answers
Actually the code is working fine. But the event is inserted in the calender and its not showing in the current site__c detail page. I just want to know if it is possible for custom objects.
Please put this code:
event.WhatId = site.Id;
Hi Bond,
Thanks for the reply. Now the event in homepage has a lookup to the site detail page. Still it is not showing under activities of the site detail page.
What is the value of “Date_Of_Next_Level_Of_Construction__c” field in your record.
For testing I am giving todays date.
Okay I got it. My activity automatically closes right. Thank you so much Bond