3

After I modify StartDateTime of an instance of recurring events series, it would be nice if I still could get information about it's original position in the series. Other systems, like Microsoft Exchange and Google Calendar provide special field OriginalStartTime for that purpose, so i was expecting something like that to be present in Salesforce as well. However I couldn't find anything similar in documentation: https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_event.htm

Can it be calculated somehow? I ended up generating a sequence of dates according to recurrence rule and matching occurrences to those dates, by finding the closest one. But this is too complex and won't work in 100% cases. So I wonder is there a better solution?

Thanks in advance.

1

You goal is to capture the original value of the Event record, regardless of whether it is changed. Natively, the Event object (nor do most) capture the initial value of a field automatically. What you'll need to do is the following:

  1. Create Custom Field on Event (might be "Activities" object) named Intitial Start Date/Time
  2. Create a Workflow Rule on the Event Object and set it to run when a record is created and for the criteria, use something like when ActivityDateTime is null --> this way it always fires the Workflow Rule
  3. Add an Field Update Action to the Workflow and set the value of Intitial Start Date/Time equal to Event.ActivityDateTime.
  4. Activate the Workflow rule after saving

At this point, all new events will have this value stored. You will have to use a data loader to populate a value for all records currently in salesforce.

Now, no matter what value a user changes the ActivityDateTime, you'll always have the initial value when it was born...

  • Thanks for the quick answer. Not sure I got your point however. I'm aware of RecurrenceActivityId field, but my problem is that event can be moved to arbitrary position in the calendar. Say, I have a monthly event that occurs on 1st day of every month. If one of the occurrences (say, September 1st) was moved to September 15th, how can I get its original start? I think maybe I was unclear with my question. I need original date/time, not just time. – Lev Sivashov Sep 23 '15 at 14:01
  • Ah, much more specific! I'll update my answer above. – James Sep 23 '15 at 14:19
  • Thanks for the answer. Still don't know if this will work for me. There might be some other requirements, like support for existing calendars/events. Considering another approaches now. I'll definitely let you know what I ended up with. PS. Sorry, looks like my reputation is too low to upvote your answer :( – Lev Sivashov Sep 25 '15 at 11:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.