handlers.sync_milestones_and_lifecycles_handler

class SyncMilestonesAndLifecyclesHandler(handlers.eventhandler.EventHandler):

Synchronizes Milestones into Lifecycle fields. In case of a timing conflict, all other conflicting lifecycle phases are updated automatically to the earliest / lastest non-conflicting value.

Configuration:
mapping: Key/value pairs of Milestone Name and lifecycle field.
conditions: Key/value pairs of a field name and a list of values. If the field's value is in the value list, the automation is executed.

Example: "mapping": {"Start": "plan", "End": "endOfLife"}
Writes the Start milestone into the plan lifecycle and the End milestone into the endOfLife lifecycle.

name = 'Sync Milestones into Lifecycle Fields'
description = "Automatically copy milestones into their corresponding lifecycle fields, e.g. 'Project End' => 'End of Life'."
conditions = {'event_types': ['FactSheetUpdatedEvent']}
supports_initial_sync = True
config_template = {'fs_types': ['Project'], 'mapping': {'Start': 'plan', 'End': 'endOfLife'}, 'lifecycle_field': 'lifecycle', 'lifecycle_order': ['plan', 'phaseIn', 'active', 'phaseOut', 'endOfLife'], 'conditions': {'state': ['submission', 'preparation', 'alignment', 'implementation']}}
def handle(self, event, fs, **kwargs):

Called automatically whenever a FactSheetUpdated event comes in via webhook.