{
  "cloud": true,
  "rules": [
    {
      "id": 1,
      "name": "Deletion log 1 of 2 - copy each new comment into the Environment field",
      "state": "DISABLED",
      "description": "Free rule published by Oskvarden. Rule 1 of 2: appends each new comment (date, author, text) to the Environment field, so that rule 2 can log it when the work item is deleted. Only work items matched by the JQL condition are touched: edit the condition before you enable the rule. Measured limits: two comments added at the same time can lose one without any error; edited comments are not followed; the field stops at 32,767 characters.",
      "created": 1794700800000,
      "updated": 1794700800000,
      "trigger": {
        "component": "TRIGGER",
        "type": "jira.issue.event.trigger:commented",
        "value": {
          "eventTypes": [],
          "eventFilters": [
            "ari:cloud:jira::site/00000000-0000-0000-0000-000000000000"
          ]
        },
        "conditions": [],
        "children": [],
        "schemaVersion": 1
      },
      "components": [
        {
          "component": "CONDITION",
          "type": "jira.jql.condition",
          "value": "labels = keep-comment-copy",
          "conditions": [],
          "children": [],
          "schemaVersion": 1
        },
        {
          "component": "ACTION",
          "type": "jira.issue.edit",
          "value": {
            "operations": [
              {
                "field": {
                  "type": "ID",
                  "value": "environment"
                },
                "fieldType": "environment",
                "type": "SET",
                "value": "{{issue.environment}} || {{comment.created}} {{comment.author.displayName}} : {{comment.body}}"
              }
            ],
            "advancedFields": null,
            "sendNotifications": true
          },
          "conditions": [],
          "children": [],
          "schemaVersion": 12
        }
      ],
      "canOtherRuleTrigger": false,
      "notifyOnError": "FIRSTERROR",
      "projects": [],
      "labels": [],
      "ruleScope": {
        "resources": [
          "ari:cloud:jira::site/00000000-0000-0000-0000-000000000000"
        ]
      },
      "writeAccessType": "OWNER_ONLY"
    },
    {
      "id": 2,
      "name": "Deletion log 2 of 2 - record a deleted work item in the audit log",
      "state": "DISABLED",
      "description": "Free rule published by Oskvarden. Rule 2 of 2: when a work item is deleted, writes its fields, its description, its sub-task and link keys, its attachment names, its time totals and the comment copy kept by rule 1 to this rule's audit log. Jira gives a deletion rule no comments, no attachment content and no change history. The audit log is kept for a limited time and shortens long entries.",
      "created": 1794700800000,
      "updated": 1794700800000,
      "trigger": {
        "component": "TRIGGER",
        "type": "jira.issue.event.trigger:deleted",
        "value": {
          "eventKey": "jira:issue_deleted",
          "issueEvent": "issue_deleted",
          "eventFilters": [
            "ari:cloud:jira::site/00000000-0000-0000-0000-000000000000"
          ]
        },
        "conditions": [],
        "children": [],
        "schemaVersion": 1
      },
      "components": [
        {
          "component": "ACTION",
          "type": "codebarrel.action.log",
          "value": "DELETED-FIELDS key={{issue.key}} | type={{issue.issueType.name}} | summary={{issue.summary}} | status={{issue.status.name}} | priority={{issue.priority.name}} | assignee={{issue.assignee.displayName}} | reporter={{issue.reporter.displayName}} | labels={{issue.labels}} | due={{issue.duedate}} | parent={{issue.parent.key}} | created={{issue.created}} | deleted_by={{initiator.displayName}}",
          "conditions": [],
          "children": [],
          "schemaVersion": 1
        },
        {
          "component": "ACTION",
          "type": "codebarrel.action.log",
          "value": "DELETED-DESCRIPTION key={{issue.key}} | {{issue.description}}",
          "conditions": [],
          "children": [],
          "schemaVersion": 1
        },
        {
          "component": "ACTION",
          "type": "codebarrel.action.log",
          "value": "DELETED-OTHER key={{issue.key}} | subtasks={{issue.subtasks.key}} | links={{#issue.issuelinks}}{{type.name}}>{{inwardIssue.key}}{{outwardIssue.key}};{{/}} | attachments={{issue.attachment.filename}} | time_spent={{issue.timetracking.timeSpent}} | estimate={{issue.timetracking.originalEstimate}}",
          "conditions": [],
          "children": [],
          "schemaVersion": 1
        },
        {
          "component": "ACTION",
          "type": "codebarrel.action.log",
          "value": "DELETED-COMMENT-COPY key={{issue.key}} | {{issue.environment}}",
          "conditions": [],
          "children": [],
          "schemaVersion": 1
        }
      ],
      "canOtherRuleTrigger": false,
      "notifyOnError": "FIRSTERROR",
      "projects": [],
      "labels": [],
      "ruleScope": {
        "resources": [
          "ari:cloud:jira::site/00000000-0000-0000-0000-000000000000"
        ]
      },
      "writeAccessType": "OWNER_ONLY"
    }
  ]
}
