handlers.fact_sheet_deletion_mail_handler

class FactSheetDeletionMailHandler(handlers.eventhandler.EventHandler):

Whenever somebody archives a fact sheet, inform the admin team (or whoever you like), so they can double-check. It either sends an e-mail to the e-mail address configured in the global configuration
(Company level) of your instance, or it creates a to-do in the to-do fact specified in the configuration.

If you are unsure how to configure your instance, please contact Aronis support.

exceptions: List of e-mail addresses of users whose actions should not trigger a notification, e.g. admin users.
todo_fact_sheet: id of the fact sheet where the notification will be attached.
todo_recipient: e-mail address of the recipient of the to-do notification.
title: Title of the to-do, or subject of the notification e-mail. body: Body of the to-do or the e-mail. Supported placeholders: $DISPLAY_NAME, $USER_EMAIL, $FS_URL, $COMMENT.

If todo_fact_sheet / todo_recipient are not set, the notification will be sent as e-mail.

name = 'Notification: Fact Sheet Archived'
description = 'When somebody archives a fact sheet, either create a to-do notification or send an e-mail notification to one or more recipients.'
conditions = {'event_types': ['FactSheetArchivedEvent']}
config_template = {'exceptions': ['admin1@example.com', 'admin2@example.com'], 'todo_fact_sheet': '12345678-...', 'todo_recipient': 'john.doe@example.com', 'title': "Fact Sheet deleted: '$DISPLAY_NAME'", 'body': "$USER_EMAIL deleted the fact sheet '$DISPLAY_NAME' $FS_URL\\nDeletion comment: '$COMMENT'"}
def data_requirements(self):

Declare the exact fact-sheet data this handler needs, so the webhook event loop (process_event in workspace/views_module.py) can load a single lean FastFactSheet per event instead of the full fact sheet.

Return a dict: { "fields": [], "relations": [], "subscriptions": bool, # True if handle() reads fs["subscriptions"] "tags": bool, # True if handle() reads tags / has_tag() "documents": bool, "acls": bool, "completion": bool, # True if handle() reads fs["completion"] "base_fields": [], # optional; omit/None = full # default base field set. A list restricts the # base scalars to just those (id and type are # always loaded). Advanced opt-in for max speed. } Fields referenced by this handler's trigger are folded in automatically by the event loop (into "fields"), so only declare what handle() itself needs on top of them.

Return None (the default) to signal "requirements cannot be declared statically" - e.g. handlers that exec/eval config-supplied code. The event loop then loads the full fact sheet for that event, so correctness is always preserved. This is a standalone hook (deliberately not tied to the initial_sync_* hooks, which are slated to migrate onto it later).

def handle(self, event, fact_sheet, **kwargs):

Called automatically whenever a FactSheetCreated or FactSheetUpdated event comes in via webhook.

def initial_sync_event(self, fs):