Automation Rules for import and export

Performing automated CSV import and export operations by using Automation Rules

A CSV import and export can be triggered by an Automation Rule (AR). In order to perform a CSV import or export by an Automation Rule, the CSV Import/Export profile must be created first. (SETTINGS >> CONNECTION >> Integrations). The 'Automation Rules' option is found in SETTINGS >> AUTOMATION >> 'Automation Rules' on the left navigation. Note: you will need Admin permissions to access both sections.

  1. Create a valid and complete CSV import or export profile and copy its ID - it can be found at the top of the profile details page

  2. Having a profile created and enabled, go to SETTINGS >> AUTOMATION >> 'Automation Rules' and click 'Create new rule'

  3. Choose the trigger for this rule (WHEN) from the dropdown list and other conditions if needed (+ AND)

  4. In the field + THEN select 'Run CSV Import' or 'Run CSV Export' and choose the relevant profile from the dropdown list. Please make sure that the chosen profile is properly set up (indicates the ADM dataset and includes mapping).

  5. Save the automation rule. As soon as it's triggered, the operation as set up in the profile will run once.

NOTES AND RECOMMENDATIONS:

  1. Only an enabled profile can be run using Automation Rules
  2. If an import profile is already perforeming an import, any subsequent attempts to trigger (again/also) it by an AR will be ignored
  3. It's recommended to assess the duration and impact of a profile run before automating its execution
  4. An Export profile that export to a local CSV can't be automated - such AR will fail
  5. There is no mechanism to restrict the import source or the export destination changes - make sure the profile under automation stays untouched
  6. Currently there is no mechanism to trigger AR by the dataset changes or any other events in ADM
  7. While import profiles' runs are put to queue if there are too many intentions, the export profile runs have no such queueing mechanism

Running Automation Rules triggered by ADM events

A CSV import and export can be also executed by an Automation Rule triggered by ADM events (e.g. dataset changes). The following prerequisites must be filled to perfrom such an AR:

  • the profile, including mapping and connected to ADM, must be created
  • the profile must be saved
  • import or export must be performed at least once. It can be done manually.

To create an Automation Rule (AR) for both export and import, the following JSON should be specified as the WHEN condition:

{
  "type": "source:generic",
  "clientId": "adm-subscriber-cluster-worker",
  "payloadType": "adm-dataset-changed"
}

The following JavaScript should be pasted into the AND field, with 'ADM dataset name' being replaced by the dataset name used in the specific profile:

if (args.payload.admDatasetsNames.indexOf('ADM dataset name') >= 0) {
  return true;
}
return false;

Running Automation Rules when import or export is completed

To perform additional actions once the import or export has been completed, an Automation Rule triggered by this event can be created. To integrate with triggers from import/export, the following json as WHEN condition listed below should be specified:

  • for import
{  
    "type": "source:generic",  
    "clientId": "csv-import",  
    "payloadType": "csv-import"  
  }
  • for export
 {  
  "type": "source:generic",  
  "clientId": "csv-export",  
  "payloadType": "csv-export"  
 }

Also the following javascript condition with the proper profileID should be added:

return args.palyload.profileId = '[id_of_the_profile]'