1

Is there an easy access to a readable recurring string from Apex? In the UI of the event, if it is recurring, you will see info like:

Occurs every 1 week(s) on Sunday, Tuesday effective 06/20/2017 until 7/27/2017 From 2:00 PM until 3:00 PM

Do they assemble this on their end from all the recurrence fields? If they do, have they haven't made another field to store this text string?

0

There isn't a direct string, at least not for the day of the week, but there are ways of generating one. If you look at the Object Reference for Event, you'll see that you first need to determine if the IsRecurrence field is set to true. If it is, then you'll want to look at the following fields:

IsChild

Indicates whether the event is a child of another event (true) or not (false).

For a child event, you can update IsReminderSet and ReminderDateTime only. You can query and delete a child event. If the objects related to the child event are different from those related to the parent event (this difference is possible if you use API version 25.0 or earlier) and one of the objects related to the child event is deleted, the objects related to the parent event are updated to ensure data integrity.

RecurrenceActivityId

Read-only. Not required on create. Contains the ID of the main record of the recurring event. Subsequent occurrences have the same value in this field.

RecurrenceDayOfMonth

Indicates the day of the month on which the event repeats. (Integer)

RecurrenceDayOfWeekMask

Indicates the day or days of the week on which the event repeats. This field contains a bitmask. The values are as follows:

  • Sunday = 1
  • Monday = 2
  • Tuesday = 4
  • Wednesday = 8
  • Thursday = 16
  • Friday = 32
  • Saturday = 64

Multiple days are represented as the sum of their numerical values. For example, Tuesday and Thursday = 4 + 16 = 20.

You'd need to work backward from any value contained in this bitmask to determine the string value to associate with it.

RecurrenceInstance

Indicates the frequency of the event’s recurrence. For example, 2nd or 3rd.

RecurrenceInterval

Indicates the interval between recurring events. (Integer)

RecurrenceMonthOfYear

Indicates the month in which the event repeats. (picklist)

See the link above for more fields you can use to build a string about the event.

| improve this answer | |
  • So I will have to query the recurrence parent (based on ReccurenceActivityId of child events) and get all that recurrence information (because from what I see, it is only set on the recurrence parent). Then construct a readable string of the recurrence rules? – Tyler Dahle Jul 24 '17 at 17:39
  • That pretty much sums it up. – crmprogdev Jul 24 '17 at 22:04

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.