Calendar Events - How to get the list of the changed fields handling the AfterUpdate event?

Hi

we have a case where we need to know which fields were changed, after a calendar event is updated. There is an ability to handle the AfterUpdate event, but there is no BeforeUpdate event. Also the AfterUpdate event doesn't contain any information about the updated fields. 

Do you know how to get such information?

Thank you in advance

  • Hi Chris. You should be able to use the BeforeUpdate event for Calendars. Was this not firing as expected?

  • Hi Michael

    unfortunatelly it is not triggered when an event is updated.
    For the test I've initialized both:

    public void Initialize()
    {
    this._eventsApi = Apis.Get<IEvents>();
    this._calendarApi = Apis.Get<ICalendars>();
    this._calendarApi.Events.BeforeUpdate += this.Events_BoforeUpdate;
    this._eventsApi.CalendarEventEvents.AfterUpdate += this.Events_AfterUpdate;
    }

    and found that when an event is saved only the "_eventsApi.CalendarEventEvents.AfterUpdate" is triggered.

    also there is no _eventsApi.CalendarEventEvents.BeforeUpdate event

  • Hi again, Chris. I looked into this further and have some good news and bad news.

    The good:

    BeforeUpdate does exist and is triggered. You don't need IEvents, just Telligent.Evolution.Extensions.Calendar.Extensibility.Api.Version1.ICalendars. The following plugin sample will handle calendar before update events.

    using System.Diagnostics;
    using Telligent.Evolution.Extensibility;
    using Telligent.Evolution.Extensibility.Version1;
    using Telligent.Evolution.Extensibility.Api.Version1;
    using Telligent.Evolution.Extensions.Calendar.Extensibility.Api.Version1;
    
    namespace CalendarTest
    {
    	public class TestCalendarPlugin : IPlugin
    	{
    		public string Name => "Calendar Event Test";
    
    		public string Description => "Calendar Event Test";
    
    		public void Initialize()
    		{
    			var calendars = Apis.Get<ICalendars>();
    
    			calendars.Events.BeforeUpdate += e =>
    			{
    				var calendar = calendars.Show(new CalendarsShowOptions { ApplicationId = e.ApplicationId });
    
    				Trace.WriteLine($"Updating calendar name from {calendar.Name} to {e.Name}");
    			};
    		}
    	}
    }

    The bad:

    This has uncovered an issue in the calendar's BeforeUpdate event arguments. 

    1. Before event arguments should be editable to allow the updated parameters to be further adjusted before saving. 
    2. Retrieving a calendar entity from the API within the BeforeUpdate event's handler should return the existing calendar with the old properties, not an entity with updated properties. 

    Both of these work in other applications, such as this blog sample below, but not in calendars.

    using System.Diagnostics;
    using Telligent.Evolution.Extensibility;
    using Telligent.Evolution.Extensibility.Version1;
    using Telligent.Evolution.Extensibility.Api.Version1;
    using Telligent.Evolution.Extensions.Calendar.Extensibility.Api.Version1;
    
    namespace BlogTest
    {
    	public class TestBlogPlugin : IPlugin
    	{
    		public string Name => "Blog Event Test";
    
    		public string Description => "Blog Event Test";
    
    		public void Initialize()
    		{
    			var blogs = Apis.Get<IBlogs>();
    
    			blogs.Events.BeforeUpdate += e =>
    			{
    				var blog = blogs.Get(e.ApplicationId);
    
    				Trace.WriteLine($"Updating blog name from {blog.Name} to {e.Name}");
    			};
    		}
    	}
    }
    

    Thank you for identifying this. I've logged this issue for review as:

    TE-15737: Calendar BeforeUpdate event prevents retrieval of existing calendar or editing of event args

    Completed for 12.0.0, 10.3.7, 11.1.5
     

    Unfortunately, I'm not aware of a supportable workaround.

  • The Calendar Events didn't work for us, so we solved the problem with creating a custom event with the updated field name and new value and the calendar event Id as arguments. And it is triggered just before the update, so it is possible to compare the old and values.

  • The BeforeUpdate and BeforeCreate events for Calendar Events have been added to the next major release after 11.0.

  • Verint | Telligent Community
    0 Verint | Telligent Community
    TE-15737: Calendar BeforeUpdate event prevents retrieval of existing calendar or editing of event args has been completed for 12.0.0, 10.3.7, 11.1.5
  • Hey - I'm running into this issue on a v10 install.  Can you share how you created the custom event?