I am facing some Errors while using Script Runner

Jayanth November 28, 2024

I am using Jira Cloud. In that while using Script Runner, I am facing this isuue.

Screenshot 2024-11-28 165010.png

I am trying to calculate the Total Time Spent by a Story in "In Progress" Status. So, whenever it moves to "Done" Status, there is custom field which shows the time spent in this format (d h m s). 
Note: The Story can be Reopened again. So, the time should be added accordingly. Below is my code for Script Runner
Screenshot 2024-11-28 165418.pngScreenshot 2024-11-28 165502.pngScreenshot 2024-11-28 165630.png

What to do?

1 answer

0 votes
Kristian Walker _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 28, 2024

Hi Jaynath,

The issue appears to be with line 122, where you go to update the issue.

ScriptRunner for Jira Cloud uses Unirest to make rest calls, so you should use Unirest rather than httpClient, which is not a supported package.

I can confirm we have an example of updating a field on an issue here on line 32 that you can use as an example to help refactor your script.

I hope this information helps.

Regards,

Kristian

Jayanth November 28, 2024

Yeah, I tried that method too, but it is not working. Do you have any other idea for my query.

Kristian Walker _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 28, 2024

What type is the field you are trying to set, and how is this script configured?

Regards,

Kristian

Jayanth November 28, 2024

The script is configured in a way that, the time starts to count when Story moves to "In Progress". And after it transition to "Done", the calculated time should be displayed in a custom field (text field) and time should stop when the Story is in "Done" status. 
Now, if the Story is reopened or moved to "In Progress" status again, the time should start. After it moves to "Done" status, the value in the custom field and this new time should be added and displayed in the custom field.


Note: The Story should only have one field for Total Time Spent by the Story in "In Progress" status. The time should in this format (days hours min sec)

Kristian Walker _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 28, 2024

Hi Jayanth,

I would advise raising this issue as a support ticket with the support team located here who will be able to help debug this issue further.

Regards,

Kristian

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events