handlers.set_field_on_field_update_handler

class SetFieldOnFieldUpdateHandler(handlers.eventhandler.EventHandler):

Whenever a fact sheet field changes to a specific field value, we set another field to a target value.
You can use this to catch manual lifecycle changes, which you cannot do in LeanIX Automations.

Configuration:
field: Name of the field to be monitored, e.g. lifecycle of an Application.
condition: Key/value pair that will be checked, e.g. lifecycle_status: endOfLife. If the condition holds true, we will set the field as specified.
mapping: Combinations of the value of the field and the value of the target field. A "*" key acts as a fallback that is used whenever no other key matches the source value - including when there is no source value at all (e.g. a to-do trigger with no field change).

Example: "endOfLife": "inactive" Sets an application to inactive if somebody manually changes its lifecycle to endOfLife.

Alternatively, gating can be expressed with the generic trigger config (see handlers/trigger.py) instead of field/condition. When a trigger is present the built-in field/condition checks are skipped (the dispatch loop has already evaluated the trigger), and source_field selects which field's value drives the mapping lookup.

Example - trigger this handler when an ACTION_ITEM to-do is completed (the to-do state lives in the event payload, not on fs; to-do events load a neutral, untyped fact sheet): "trigger": {"events": ["TODO_UPDATED"], "code": "event.get('changes',{}).get('state') == 'CLOSED'"}. Combine with a "*" mapping entry to set a constant target value when there is no source field.

name = 'Set field on field update'
description = 'Whenever somebody sets a specific field value, we set another field to a target value. Very helpful for catching a manual lifecycle change to endOfLife.'
conditions = {'event_types': ['FactSheetFieldUpdatedEvent']}
supports_initial_sync = True
config_template = {'fs_types': ['Application'], 'field': 'lifecycle', 'condition': {'lifecycle_status': 'endOfLife'}, 'target_field': 'operatingStatusAutomationTrigger', 'mapping': {'endOfLife': 'yes'}}
def handle(self, event, fs, **kwargs):

Called automatically whenever a matching event comes in via webhook.

def initial_sync_event(self, fs):