Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to copy value of "organization" CF to non servicedesk project Edited

Hi I am trying to copy organization field value to another CF in linked issue. I have some scriptrunner script and I tried to hook it on "Create issue" transition, but it is not working, any suggestions please? We have only scriptrunner.


import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.user.ApplicationUser
def cfm = ComponentAccessor.getCustomFieldManager()

ApplicationUser currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
MutableIssue parent = issue
List<IssueLink> vykazovanieLinks = ComponentAccessor.getIssueLinkManager().getOutwardLinks(parent.getId()).findAll{it.getIssueLinkType().getName().equals("Vykazovanie")}

if (vykazovanieLinks) {
Issue linkedIssue = vykazovanieLinks.find{it.getDestinationObject().getProjectObject().getKey().equals("DRGSD")}?.getDestinationObject()
log.debug('linkedIssue: ' + linkedIssue)
if (linkedIssue){
CustomField organizations = cfm.getCustomFieldObjectsByName("Organizations").getAt(0)
CustomField organizations_int = cfm.getCustomFieldObjectsByName("Zadané v mene").getAt(0)
log.debug('Organizations ' + organizations)
parent.setCustomFieldValue(organizations_int, organizations)
ComponentAccessor.getIssueManager().updateIssue(currentUser, parent, EventDispatchOption.ISSUE_UPDATED, false)


0 answers

Suggest an answer

Log in or Sign up to answer
Community showcase
Asked in Jira Service Desk

Calling all Insight users, we need your help!

Hello Insight users,  As part of our (Mindville's) acquisition by Atlassian, our training team is looking to build some new Insight training materials. It would really helpful if you can ...

96 views 1 0
View question

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you