handlers.link_fact_sheet_by_field_handler

class LinkFactSheetByFieldHandler(handlers.eventhandler.EventHandler):

Whenever somebody sets a specific field value, we link this fact sheet to another fact sheet.
If somebody changes the field value to something else, we remove the link to the other fact sheet.

Configuration:
field: Name of the field to be monitored, e.g. hostingType of an Application.
fs_type: Fact sheet type of the fact sheets to be linked automatically, e.g. ITComponent.
mapping: Combinations of the value of the field and the id of the fact sheet that should be linked automatically.

Example: "saas": "abcdefff-1234-abcd-defa-12345678abcd"
Links the ITComponent abff... if the application's hostingType value is set to "saas".

name = 'Link a Fact Sheet based on the value of a field'
description = 'Whenever somebody sets a specific field value, we link this fact sheet to another fact sheet.'
conditions = {'event_types': ['FactSheetFieldUpdatedEvent']}
supports_initial_sync = True
config_template = {'fs_types': ['Application'], 'field': 'hostingType', 'target_fs_type': 'ITComponent', 'relation': 'relApplicationToITComponent', 'mapping': {'saas': 'abcdefff-1234-abcd-defa-12345678abcd'}}
def handle(self, event, fs, **kwargs):

Called automatically whenever a FactSheetUpdated event comes in via webhook.

def initial_sync_event(self, fs):