Good afternoon. It is not possible to implement a script that, when creating a request on a custom portal, creates a certain relationship based on the completed tasks from the multiple issue pikers field.
The result of what I tried, alas, does not work.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.link.IssueLinkTypeManager
import com.atlassian.jira.issue.Issue
final def linkName = "мероприятия"
def issueLinkTypeManager = ComponentAccessor.getComponent(IssueLinkTypeManager)
def customField = ComponentAccessor.customFieldManager.getCustomFieldObject(14020)
def linkType = issueLinkTypeManager.issueLinkTypes.find{ it.name == linkName }
def story = issue.getCustomFieldValue(customField) as Issue
if (story) {
def user = ComponentAccessor.jiraAuthenticationContext.loggedInUser
ComponentAccessor.issueLinkManager.createIssueLink(story.id, issue.id, linkType.id, 0L, user)
}