Supported Add-On Api events.


Table of Contents



List of Supported Events Available for Triggering Add-On Modules

OnBefore

  • Event Scope: Script

  • Event Definition:

    "beforeAddons": [
       {
          ...
       }
    ]
    
  • Triggering Conditions:

    • Triggered once per job
    • Triggered before the migration job starts
  • Description:

    • No records are yet accessible for modification.
    • The script configuration can be modified.

OnAfter

  • Event Scope: Script

  • Event Definition:

    "afterAddons": [
       {
          ...
       }
    ]
    
  • Triggering Conditions:

    • Triggered once per job
    • Triggered after the migration job completes
  • Description:

    • Changes made will not affect the primary migration data, as the migration job has already been completed.

OnDataRetrieved

  • Event Scope: Script

  • Event Definition:

    "dataRetrievedAddons": [
       {
          ...
       }
    ]
    
  • Triggering Conditions:

    • Triggered once per job
    • Triggered after all records from all objects are retrieved from the Source and the Target, but before updating the Target.
  • Description:

    • Access and modification of source records from all objects are possible.
    • Target records from all objects can also be modified unless an Insert operation is being executed.

Object.OnBefore

  • Event Scope: ScriptObject

  • Event Definition:

    "beforeAddons": [
       {
          ...
       }
    ]
    
  • Triggering Conditions:

    • Triggered once per object in a loop
    • Triggered after all records from the Source and the Target are retrieved but before updating the Target.
    • Triggered before the OnDataRetrieved event
  • Description:

    • Similar to the OnDataRetrieved event but scoped to individual objects.
    • Allows the same modifications as the OnDataRetrieved event.

Object.OnAfter

  • Event Scope: ScriptObject

  • Event Definition:

    "afterAddons": [
       {
          ...
       }
    ]
    
  • Triggering Conditions:

    • Triggered once per object in a loop
    • Triggered after all objects are updated but before the job completes.
    • Triggered before the global OnAfter event
  • Description:

    • Similar to the global OnAfter event but scoped to individual objects.
    • Allows modifications that may still impact subsequent processing.

Object.OnFilterRecords

  • Event Scope: ScriptObject

  • Event Definition:

    "filterRecordsAddons": [
       {
          ...
       }
    ]
    
  • Triggering Conditions:

    • Triggered once per object
    • Triggered when source records are prepared for updating the Target.
    • Triggered before the OnBeforeUpdate event
  • Description:

    • Enables access, modification, and filtering of source records using the tempRecords property in the SfdmuRunAddonTask object.
    • Modified records assigned to this property will be used as the data source for updating the Target org.

Object.OnBeforeUpdate

  • Event Scope: ScriptObject
  • Event Definition:
    "beforeUpdateAddons": [
       {
          ...
       }
    ]
    
  • Triggering Conditions:
    • Triggered once per object during the target update phase
    • Triggered just before the current object is updated in the Target org.
  • Description:
    • Access and modification of the source records are possible.
    • Provides the only opportunity to modify the final version of the source records before transfer to the Target.
    • Allows working with two separated groups of records: RecordsToBeUpdated and RecordsToBeInserted.

Object.OnAfterUpdate

  • Event Scope: ScriptObject
  • Event Definition:
    "afterUpdateAddons": [
       {
          ...
       }
    ]
    
  • Triggering Conditions:
    • Triggered once per object during the target update phase
    • Triggered immediately after the current object is updated in the Target org.
  • Description:
    • Both source and target records can be accessed and modified.
    • Since this event is triggered during the update phase of the object, modifications can impact the processing of other objects that have not yet been processed.

The Add-On Event and Script Execution Lifecycle

Below is the sequence of Add-On event invocations along with script execution actions:

Action: Script execution begins...

Event: Script.OnBeforeAddons

Action: Source data query cycle starts...

Action: Querying for total record counts of each object...

Action: Querying source records...

Action: Querying target records...

Action: Source data query cycle completes...

Event: Object.OnBeforeAddons (in loop

for each object)

Event: Script.OnDataRetrieved

Action: Target update cycle starts...

Action: Update begins for the given object...

Action: Determining records needing updates or inserts for the given object...

Event: Object.OnFilterRecords

Action: Preparing records for update...

Event: Object.OnBeforeUpdateAddons

Action: Updating the target for the given object...

Event: Object.OnAfterUpdateAddons

Action: Update of the given object completed, proceed to the next object...

Action: Target update cycle completed...

Event: Object.OnAfterAddons (in loop for each object)

Event: Script.OnAfterAddons

Action: Script execution completed...

Last updated on 5th May 2024