Přeskočit obsah

Workflow Definition

Struktura workflow

workflows:
  WorkflowName:
    trigger: "afterSave|beforeSave|manual|scheduled"
    entity: "EntityName"
    isActive: true

    # Podmínky spuštění
    conditions:
      - type: "fieldEquals"
        field: "status"
        value: "New"

      - type: "fieldChanged"
        field: "status"

      - type: "fieldIsEmpty"
        field: "assignedUserId"

      - type: "formula"
        formula: "entity.get('amount') > 10000"

    # Akce
    actions:
      - type: "notification"
        target: "role:Manager"
        template: "high_value_order"

      - type: "createEntity"
        entity: "Task"
        data:
          name: "Review order {entity.number}"
          assignedUserId: "{entity.assignedUserId}"
          dateEnd: "{dateAdd(now, 1, 'day')}"

      - type: "updateEntity"
        field: "status"
        value: "UnderReview"

      - type: "sendEmail"
        to: "{entity.contact.emailAddress}"
        template: "order_confirmation"

      - type: "executeFormula"
        formula: |
          entity.set('reviewDate', datetime.now());
          entity.set('reviewerId', user.id);

Typy triggers

Trigger Popis
afterSave Po uložení záznamu
beforeSave Před uložením záznamu
manual Manuální spuštění
scheduled Plánované spuštění (cron)

Typy conditions

Typ Popis
fieldEquals Pole má konkrétní hodnotu
fieldChanged Pole bylo změněno
fieldIsEmpty Pole je prázdné
fieldIsNotEmpty Pole není prázdné
formula Vlastní formula

Typy actions

Typ Popis
notification Odeslání notifikace
createEntity Vytvoření záznamu
updateEntity Aktualizace záznamu
sendEmail Odeslání e-mailu
executeFormula Spuštění formule
createTask Vytvoření úkolu

➡️ Pokračujte na Layouts.