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
trick1trick1 

Assignment of Events to calendars

Hi Friends,

 

Can we assign events to calendars in salesforce and make it vsible on the calendar.Quick response will be greatly appreciated.

 

 

Thanks,

Trick

trick1trick1

Can somebody answer?

Thanks,

Trick

sfdcfoxsfdcfox

I assume you mean in Apex Code? Just assign the calendar's ID to the OwnerId.

Santosh SSantosh S

Yes you can assign New Event in the Calendar, you have to put/ add an Apex Trigger on the Object from which you want to update the Calendar Event

 

E.g: Apex Trigger as folows:

 

trigger UpdateTEevent on New_Object__c (after insert) {

List <Event> TENewEvents = new List <Event>();

for (New_Object__c TEevent : Trigger.new)
  {
    Event te = new Event();
    te.StartDateTime = TEevent.Start_Process_By__c;
    te.EndDateTime = TEevent.Start_Process_By__c;
    te.OwnerId = TEevent.Implementing_Person__c;
      
    TENewEvents.add(te);
  
  }
  
  insert TENewEvents;
}

 

In the above Code:

1   UpdateTEevent                                  : is the Name of the Trigger

2   New_Object__c                                 : is the Custom  Object

3   Start_Process_By__c  

     & .Implementing_Person__c          : is the Custom Field in the Custom Object

 

 

 

Hope this resolves your problem

 

 

Warm Regards