get sprint name and set summary

Hi.
I need to add the sprint name to the summary. But Id doesn't work.



def cField = customFieldManager.getCustomFieldObject("customfield_10004")
def sprint = issue.getCustomFieldValue(cField)
issue.summary = issue.summary + " - Sprint PM - " + sprint

 
The code doesn't haver sintaxis error But when a ticket is created the summare  have a bad format like this:

TEST - Sprint PM - [com.atlassian.greenhopper.service.sprint.Sprint@5a2a0cc9[id=4,rapidViewId=2,state=FUTURE,name=Sprint2,startDate=<null>,endDate=<null>,completeDate=<null>,sequence=4,goal=<null>]]


How I can get theonly the sprint name?

thanks a lot.


1 comment

getCustomFieldValue returns whatever object is stored in the custom field, and the burble you are seeing is an attempt to turn the whole "sprint" object into a simple string.

Try

sprint.getName() instead of just sprint - that should extract the name field from the object (I'm guessing that will be a simple string)

Hi @Nic Brough [Adaptavist]

thanks for your reply.

 When I change sprint to sprint.getName()

I see the following error.

 


Stactic type checking - Cannot find matching method.
java.lang.Object#getName(). Please check if the declared type is right and if the method exists.
posible solution....

 

Comment

Log in or Sign up to comment
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published 4 hours ago in Hipchat

Moving from Hipchat to Stride? Here’s what you’ll love

Heya, Hipchat friends! We’re so happy you’re checking out   Stride. Whether you know it or not, you have been instrumental in making Stride come to life. Every feature, design, and functionality...

21 views 0 3
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you