Life Cycle of Recurrence

The following sections outline the steps that occur from the perspective of a single record or change. These steps are written assuming that the single record/change is in isolation and no other records/changes are being processed in the same account.

In reality there will be many other records & changes existing in a live account at the same time which means that other unrelated actions will be taken in-between the steps outlined below. However, from the perspective of a single record/change these steps will always be taken in the order listed below.

Definitions

Recurrence — The feature that allows the user to auto-generate a series of tasks or cases that repeat more than once based on a defined set of parameters.

Field Service Recurrence Record — The record that holds a set of parameters that define the recurring behavior of the following copies in a series.

Instance or Instance Record — An individual Case or Task record that is a part of a recurrence series of recurring Tasks or Cases.

Recurrence Series — A complete set of instance records related to a specific Field Service Recurrence record.

Instance Index — A numerical value indicating where in the recurrence series a particular instance falls.

Primary Record — A Case or Task record that has an Instance Index of 1 which means that it is the original and first instance in that particular recurrence series.

Non-Primary Record — Any Case or Task record that does not have an Instance Index of 1.

Recurrence Related Fields — Any fields linked to the definition of a recurring series (e.g. start date, end type, end date, recurrence type, day of week, interval etc.)

Propagated Fields — Any fields that have been approved as fields to be propagated down to future instance records. Some fields are included in the alowlist as default fields, others are added to the allowlist through custom config.

Creation of a New Recurrence Series

When creating a completely new recurring series of cases or tasks, the following actions are taken:

  1. As you save your new instance record with some of the recurrence related fields populated, the information set in the recurrence related fields will be saved into the “Field Service Recurrence Data” field and the recurrence scheduled script will be triggered.

  2. The new instance record is then found and processed by the fact that information is present in it’s “Field Service Recurrence Data” field.

    If the “Field Service Instance Index” field is empty AND the “Field Service Propagate Changes” checkbox is unchecked AND no matching recurrence record can be found (matching on the idempotency key stored in the “Field Service Recurrence Data” field) THEN a new Field Service Recurrence record is created using the RECURRENCE_ADD_RECURRENCE action.

    As a second step the new instance record is then updated to have it’s “Field Service Recurrence” field populated with the new Field Service Recurrence record (again matching on the idempotency key stored in the “Field Service Recurrence Data” field) using the RECURRENCE_UPDATE_INSTANCE action. At this point it's “Field Service Instance Index” field is also set to be 1 and the “Create/Update Instances“ checkbox is checked on the related Field Service Recurrence record.

    As a final step the “Field Service Recurrence Data” field of the instance record is cleared out using the RECURRENCE_UPDATE_INSTANCE action.

  3. Finally the new Field Service Recurrence record is found and processed by the recurrence scheduled script as it’s “Create/Update Instances“ checkbox had been checked.

    Firstly the primary record is checked for changes, if there are any changes the Field Service Recurrence record is then updated to match (using the RECURRENCE_UPDATE_RECURRENCE action).

    Secondly, all required instance records are created using the RECURRENCE_CREATE_INSTANCE action.

Editing a Recurring Instance

Changing Recurrence Related Fields

The following actions are taken when an instance record is edited and one or more of the recurrence related fields have been modified. These actions differ slightly depending on whether the instance being modified is a primary record.

Changes to Recurrence Related Fields - Primary Record

  1. As you save your changes to your instance record, the information set in the recurrence related fields will be saved into the “Field Service Recurrence Data” field. The “Create/Update Instances“ checkbox on the related Field Service Recurrence record will be checked and the recurrence scheduled script will be triggered.

    Note:

    The “Field Service Propagate Changes” checkbox will NOT be checked on the instance record.

  2. The instance record is then found and processed by the fact that information is present in it’s “Field Service Recurrence Data” field.

    Because it’s instance index is equal to 1, the values from the “Field Service Recurrence Data” field are pushed into the related Field Service Recurrence record using the RECURRENCE_UPDATE_RECURRENCE action.

    As a final step the “Field Service Recurrence Data” field of the instance record is cleared out using the RECURRENCE_UPDATE_INSTANCE action.

  3. Finally the updated Field Service Recurrence record is found and processed by the recurrence scheduled script as it’s “Create/Update Instances“ checkbox had been checked.

    Firstly the primary record is checked for changes, if there are any more changes the Field Service Recurrence record is then updated to match (using the RECURRENCE_UPDATE_RECURRENCE action).

    Secondly the following actions are taken:

    • All missing instance records are created using the RECURRENCE_CREATE_INSTANCE action.

    • All instances who’s recurrence related fields don’t match the recurrence series are updated to again follow the schedule using the RECURRENCE_UPDATE_INSTANCE action.

    • Any instances that exist that fall outside of the range of the recurrence series are deleted using the RECURRENCE_DELETE_INSTANCE action.

Changes to Recurrence Related Fields - Non-Primary Record

  1. As you save your changes to your instance record, the information set in the recurrence related fields will be saved into the “Field Service Recurrence Data” field. The recurrence scheduled script will be triggered.

    Note:

    The “Field Service Propagate Changes” checkbox will NOT be checked on the instance record.

  2. The instance record is then found and processed by the fact that information is present in it’s “Field Service Recurrence Data” field.

    Because it’s instance index is NOT equal to 1 a new Field Service Recurrence record is created using the RECURRENCE_ADD_RECURRENCE action.

    As a second step the old recurrence is ended using the RECURRENCE_END_RECURRENCE action and then the instance record is updated using the RECURRENCE_UPDATE_INSTANCE action and the following changes are made:

    • The "Field Service Recurrence" field populated with the new Field Service Recurrence record.

    • The “Field Service Propagate Changes” checkbox is checked.

    • The ““Field Service Recurrence Data” field is cleared out.

    This process also results in the “Create/Update Instances“ checkbox on the new Field Service Recurrence record being checked.

  3. The recurrence scheduled script locates the instance record once more and because it’s “Field Service Propagate Changes” checkbox has been checked it is processed to become the new primary record.

    All future instances are moved under the new Field Service Recurrence record using the RECURRENCE_UPDATE_INSTANCE action to adjust their index and set their “Field Service Recurrence” field.

    The instance index of the new primary record is then set to be equal to 1 (also using the RECURRENCE_UPDATE_INSTANCE action).

  4. Finally the new Field Service Recurrence record is found and processed by the recurrence scheduled script as it’s “Create/Update Instances“ checkbox had been checked.

    Firstly the primary record is checked for changes, if there are any more changes the Field Service Recurrence record is then updated to match (using the RECURRENCE_UPDATE_RECURRENCE action).

    Secondly the following actions are taken:

    • All missing instance records are created using the RECURRENCE_CREATE_INSTANCE action.

    • All instances who’s recurrence related fields don’t match the recurrence series are updated to again follow the schedule using the RECURRENCE_UPDATE_INSTANCE action.

    • Any instances that exist that fall outside of the range of the recurrence series are deleted using the RECURRENCE_DELETE_INSTANCE action.

Changing Propagated Fields

The following actions are taken when an instance record is edited and one or more of the propagated fields have been modified. These actions differ slightly depending on whether the instance being modified is a primary record.

Changes to Propagated Fields - Primary Record

  1. Upon saving the instance record, the user is presented with the option to propagate field values.

    If they select “No” then the fields are stored in the “Field Service Exempt Sync” field on the instance record and no other steps are taken.

    If the user instead selects “Yes” then the changed fieldids are stored in the “Field Service Recurrence Updates” field and because the instance index is equal to 1, the “Field Service Propagate Changes” checkbox is left un-checked.

    The “Create/Update Instances“ checkbox is then checked on the related Field Service Recurrence record.

  2. Next the new Field Service Recurrence record is found and processed by the recurrence scheduled script as it’s “Create/Update Instances“ checkbox had been checked.

    Firstly the primary record is checked for changes, if there are any changes (including changes found in the “Field Service Recurrence Updates” field) the Field Service Recurrence record is then updated to match using the RECURRENCE_UPDATE_RECURRENCE action.

    Secondly, all instance records are update using the RECURRENCE_UPDATE_INSTANCE action.

Changes to Propagated Fields - Non-Primary Record

  1. Upon saving the instance record, the user is presented with the option to propagate field values.

    If they select “No” then the fields are stored in the “Field Service Exempt Sync” field on the instance record and no other steps are taken.

    If the user instead selects “Yes” then the changed fieldids are stored in the “Field Service Recurrence Updates” field.

    Because the instance index is NOT equal to 1 the following actions are taken:

    • The “Field Service Propagate Changes” checkbox is checked on the instance.

    • A new Field Service Recurrence record is created as a copy of the existing recurrence record.

    • The old Field Service Recurrence record is ended.

    • The new Field Service Recurrence record is set in the “Field Service Recurrence” field on the instance record.

    The “Create/Update Instances“ checkbox is then checked on the new Field Service Recurrence record.

  2. The recurrence scheduled script locates the instance record and because it’s “Field Service Propagate Changes” checkbox has been checked it is processed to become the new primary record.

    All future instances are moved under the new Field Service Recurrence record using the RECURRENCE_UPDATE_INSTANCE action to adjust their index and set their “Field Service Recurrence” field.

    The instance index of the new primary record is then set to be equal to 1 (also using the RECURRENCE_UPDATE_INSTANCE action).

  3. Finally the new Field Service Recurrence record is found and processed by the recurrence scheduled script as it’s “Create/Update Instances“ checkbox had been checked.

    Firstly the primary record is checked for changes, if there are any changes (including changes found in the “Field Service Recurrence Updates” field) the Field Service Recurrence record is then updated to match using the RECURRENCE_UPDATE_RECURRENCE action.

    Secondly, all instance records are update using the RECURRENCE_UPDATE_INSTANCE action.

Deletion of Recurring Instance

When an instance record is deleted the following actions are taken.

  1. If the instance is not the primary record, it’s instance index is added to the “Deleted Instances” field on the related Field Service Recurrence record. If the instance is the primary record, the next instance in the series is found and made to be the new primary record by:

    • Checking it’s “Field Service Propagate Changes” checkbox.

    • Adjusting the values on the related Field Service Recurrence record to match the start date of the new primary record.

    Note:

    If an appropriate second instance cannot be found, then the related Field Service Recurrence record is marked for deletion.

  2. The recurrence scheduled script locates instance record and because it’s “Field Service Propagate Changes” checkbox has been checked it is processed to become the new primary record.

    All future instances are moved under the new Field Service Recurrence record using the RECURRENCE_UPDATE_INSTANCE action to adjust their index and set their “Field Service Recurrence” field.

    The instance index of the new primary record is then set to be equal to 1 (also using the RECURRENCE_UPDATE_INSTANCE action).

  3. Finally the new Field Service Recurrence record is found and processed by the recurrence scheduled script as it’s “Create/Update Instances“ checkbox had been checked.

    Firstly the primary record is checked for changes, if there are any changes (including changes found in the “Field Service Recurrence Updates” field) the Field Service Recurrence record is then updated to match using the RECURRENCE_UPDATE_RECURRENCE action.

    Secondly, all instance records are update using the RECURRENCE_UPDATE_INSTANCE action.

Delete Future Instance Button

The following actions are taken when the “Delete Future Instances” button is pressed on an instance record.

  1. The related recurrence record is updated to have it’s end type and end date fields set such that no future instances should exist. It’s “Create/Update Instances“ checkbox is then checked.

  2. Next the new Field Service Recurrence record is found and processed by the recurrence scheduled script as it’s “Create/Update Instances“ checkbox had been checked.

    Firstly the primary record is checked for changes, if there are any more changes the Field Service Recurrence record is then updated to match (using the RECURRENCE_UPDATE_RECURRENCE action).

    Secondly any instances that exist that fall outside of the range of the recurrence series are deleted using the RECURRENCE_DELETE_INSTANCE action.

General Notices