handlers.link_fact_sheet_by_tag_handler

class LinkFactSheetByTagHandler(handlers.eventhandler.EventHandler):

Whenever somebody sets a specific tag, we link this fact sheet to another fact sheet.

Configuration:
fs_type: Fact sheet type of the fact sheets to be linked automatically, e.g. ITComponent.
relation: The relation type that will be used for linking.
mapping: Combinations of the tags and the ids of the fact sheets that should be linked automatically.

Examples:

"EAI": {
"*": "abcdefff-1234-abcd-defa-12345678abcd"
}

Links the fact sheet abcd... if any tag in the group EAI is added.

"EAI": {
"LeanIX Team": "abcdefff-1234-abcd-defa-12345678abcd"
}

Links the fact sheet abcd... if the tag "LeanIX Team" in the tag group "EAI" is added.

name = 'Link a Fact Sheet based on tags'
description = 'Whenever somebody assigns a specific tag, we link this fact sheet to another fact sheet.'
conditions = {'event_types': ['FactSheetUpdatedEvent']}
supports_initial_sync = True
config_template = {'fs_types': ['Application'], 'relation': 'relApplicationToITComponent', 'mapping': {'EAI': {'*': 'abcdefff-1234-abcd-defa-12345678abcd'}}}
def handle(self, event, fs, **kwargs):

Called automatically whenever a FactSheetUpdated event comes in via webhook.