You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

On this page

Use case

Add links to the issues included in a ScriptRunner Issue Picker field and delete them if the issues are removed from the field automatically.

Configuration

Create a new rule and name it appropriately.

Providing a description will help you to identify what the rule does but this step is optional.



Field changed event

Add a trigger → Field changed event

Field

Select the ScriptRunner Issue Picker field

Change to

Select Any value


Boolean condition

Add a Condition next to the trigger → Boolean Condition 

Expression

Use the following Parser Expression after replacing the project key with the one of the project of your choice.

%{trigger.issue.project.key} = "CASE"



Next to the Boolean Condition click on Add → Action → Delete issue link

Issue link type

Choose relates to (Relates)

Issue selection

Choose All issues

Boolean condition

Add a Condition under the action → Boolean Condition 

Expression

Use the following Parser Expression.

%{trigger.issue.cfIssuePicker} != NULL



Next to the Boolean Condition click on Add → Action → Create issue link

Issue link type

Choose relates to (Relates)

Issue selection

Choose Issue List Expression

Use the following Parser Expression

issueKeysToIssueList(%{trigger.issue.cfIssuePicker})

Enable the rule by clicking on the Enable button → 



JSON

Import the example

Import the JSON file below to get started in no time

After importing the JSON file, make sure to check the configuration of the rule. Non-existing configuration elements (issue types, fields, values etc.) will be highlighted.

{
    "name": "Add links to the issues in a ScriptRunner Issue Picker field",
    "description": "Add links to the issues included in a ScriptRunner Issue Picker field and delete them if the issues are removed from the field automatically.",
    "creator": "admin",
    "status": false,
    "triggerData": "",
    "triggerType": "FIELD_CHANGED_EVENT",
    "configuration": {
        "refs": [
            "issue",
            "system",
            "trigger.issue",
            "trigger.parent"
        ],
        "fieldId": "10700",
        "option": "any"
    },
    "children": [
        {
            "sequence": 0,
            "type": "BOOLEAN_CONDITION",
            "ruleEntityType": "CONDITION",
            "configuration": {
                "refs": [
                    "issue",
                    "project",
                    "system",
                    "trigger",
                    "trigger.issue",
                    "trigger.parent"
                ],
                "expression": "%{trigger.issue.project.key} = \"KP\"",
                "expressionParsingMode": "logical",
                "actingUser": "field_00020"
            },
            "children": [
                {
                    "sequence": 0,
                    "type": "DELETE_ISSUE_LINK",
                    "ruleEntityType": "ACTION",
                    "configuration": {
                        "refs": [
                            "issue",
                            "project",
                            "system",
                            "trigger",
                            "trigger.issue",
                            "trigger.parent"
                        ],
                        "issueLinks": [
                            "inwards_10003"
                        ],
                        "destinationIssueSelection": "issues",
                        "destinationIssueSelectionIssues": "issueKeysToIssueList(toString(toStringList(replaceAll(previousValue(%{issue.cf10700}),\"\\\\[|\\\\]\", \"\"),\",\") EXCEPT toStringList(%{issue.cf10700},\", \")))",
                        "destinationIssueSelectionIssueKeyParsingMode": "textAdvanced",
                        "actingUser": "field_00020"
                    },
                    "children": null,
                    "hasChildren": false
                },
                {
                    "sequence": 1,
                    "type": "BOOLEAN_CONDITION",
                    "ruleEntityType": "CONDITION",
                    "configuration": {
                        "refs": [
                            "issue",
                            "project",
                            "system",
                            "trigger",
                            "trigger.issue",
                            "trigger.parent"
                        ],
                        "expression": "%{trigger.issue.cf10700} != NULL\r\n",
                        "expressionParsingMode": "logical",
                        "actingUser": "field_00020"
                    },
                    "children": [
                        {
                            "sequence": 0,
                            "type": "LINK_ISSUE",
                            "ruleEntityType": "ACTION",
                            "configuration": {
                                "refs": [
                                    "issue",
                                    "project",
                                    "system",
                                    "trigger",
                                    "trigger.issue",
                                    "trigger.parent"
                                ],
                                "issueLinkType": "inwards_10003",
                                "destinationIssueSelection": "issues",
                                "destinationIssueSelectionIssues": "issueKeysToIssueList(%{trigger.issue.cf10700})",
                                "destinationIssueSelectionIssueKeyParsingMode": "textBasic",
                                "actingUser": "field_00020"
                            },
                            "children": null,
                            "hasChildren": false
                        }
                    ],
                    "hasChildren": true
                }
            ],
            "hasChildren": true
        }
    ],
    "hasChildren": true
}

If you still have questions, feel free to refer to our support team.