You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.
View groupJoin the community to find out what other Atlassian users are discussing, debating and creating.
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.issue.link.IssueLink
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)
}
}
Hi @Lukáš_Krajči ,
did you succeed in resolving this issue? I can see that the problem is probably in the line:
parent.setCustomFieldValue(organizations_int, organizations)
The second variable "organizations" should be the new value of the custom field, but you have stored only the custom field itself, not it's value.
Which type does "Zadané v mene" custom field have? Is it a text field? Thank you.
We often have questions from folks using Jira Service Management about the benefits to using Premium. Check out this video to learn how you can unlock even more value in our Premium plan. &nb...
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.