handlers.copy_relations_handler

class CopyRelationsHandler(handlers.eventhandler.EventHandler):

Copies a relation from one relation field to another on the same fact sheet whenever a new relation is created.
Example: Copy the relation category into the field architectureFsCategory:
{ "source": "relApplicationToOwnerUserGroup", "target": "relApplicationToCyberSecurityOwnershipUnit", "only_copy_if_target_is_empty": True }

name = 'Copy Fact Sheet Relations'
description = 'Copies a relation from one relation field to another on the same fact sheet whenever a new relation is created.'
supports_initial_sync = True
conditions = {'event_types': ['RelationCreatedEvent'], 'fs_types': ['Application']}
config_template = {'source': 'relApplicationToOwnerUserGroup', 'target': 'relApplicationToCyberSecurityOwnershipUnit', 'only_copy_if_target_is_empty': True}
def handle(self, event, fs, **kwargs):

Called automatically whenever a matching event comes in via webhook.