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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,559,210
Community Members
 
Community Events
184
Community Groups

Update a single issue picker using the issue key - groovy

Edited

Hi all,

 

I have to update the single issue picker (custom field name = Test Linking) based on the issue key (TEST-130) but no luck. I am getting the below error when logging.

 

def issueManager = ComponentAccessor.getIssueManager()
def issueTest_130 = issueManager.getIssueObject("TEST-130")
def myval = cFieldValue

def customFieldManager = ComponentAccessor.getCustomFieldManager()
MutableIssue issueTest_130_= (MutableIssue) issueTest_130
def textCf2 = customFieldManager.getCustomFieldObjects(issueTest_130).find {it.name == "Test Linking"}

log.debug("textCf2 : "+textCf2)
log.debug("textCf2 : "+textCf2.getClass())

if (textCf2) {
def changeHolder = new DefaultIssueChangeHolder()
textCf2.updateValue(null, issueTest_130_, new ModifiedValue(issueTest_130_.getCustomFieldValue(textCf2), myval),changeHolder)
log.debug("testcf2 is updated")
}

 

Log:

 

2020-03-01 14:03:08,403 DEBUG [acme.CreateSubtask]: textCf2 : Test Linking
2020-03-01 14:03:08,404 DEBUG [acme.CreateSubtask]: textCf2 : class com.atlassian.jira.issue.fields.ImmutableCustomField
2020-03-01 14:03:08,408 ERROR [workflow.ScriptWorkflowFunction]: *************************************************************************************
2020-03-01 14:03:08,408 ERROR [workflow.ScriptWorkflowFunction]: Script function failed on issue: TEST-133, actionId: 81, file: <inline script>
java.lang.ClassCastException: java.lang.String cannot be cast to com.atlassian.jira.issue.Issue
	at com.codedpoetry.easylinks.customfields.SingleIssueLinkCF.updateValue(SingleIssueLinkCF.java:63)
	at com.atlassian.jira.issue.fields.ImmutableCustomField.updateValue(ImmutableCustomField.java:426)
	at com.atlassian.jira.issue.fields.ImmutableCustomField.updateValue(ImmutableCustomField.java:396)
	at com.atlassian.jira.issue.fields.OrderableField$updateValue.call(Unknown Source)
	at Script1172.run(Script1172.groovy:77)

 

2 answers

Hello @Sibi_K  / @Rolf Lader ,

Any luck on this issue?

Hello @Sibi_K 

Have you found a solution for your problem?

Best regards, Rolf

Suggest an answer

Log in or Sign up to answer