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

Can't pull time spent on an issue

I am trying to pull time spent to calculate the cost of an issue, but am unable to do so. Does anyone see something wrong with what I am doing?

<!-- @@Formula: 

public static double CalculateSubTotal(Double timeSpent) {
	if (timeSpent != null) {
		return timeSpent * 60;
	}
	else {
		return 0;
	}
}

CalculateSubTotal(Double.parseDouble(issue.get("timespent")))

 -->

1 answer

1 accepted

0 votes
Answer accepted

The Time Spend field is of type Long, not String. So your formula should look like:

<!-- @@Formula: 
 
public static double CalculateSubTotal(Long timeSpent) {
    if (timeSpent != null) {
        return timeSpent * 60;
    }
    else {
        return 0;
    }
}
 
CalculateSubTotal(issue.get("timespent"))
 
 -->

I figured it was something simple, but just couldn't see it. Thank you!

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Marketplace Apps & Integrations

Marketplace Spotlight: Manage your assets with asset management apps

  The role of IT professionals has become increasingly difficult over the last decade. Our organizations work in an increasingly software-powered world and IT professionals are expected to not...

260 views 3 9
Read article

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