Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

ScriptRunner assistance

Gregory Kremer
Contributor
October 5, 2022 edited

Hi everyone,

A while back Kristian Walker from Adaptavist published an example script for clearing fields in cloned issues: https://bitbucket.org/snippets/Adaptavist/ynXxME

Unfortunately, there was no definition for the "Checkbox" field type (from the script):

// Specify the custom field names below for the Single Line Text Field ensuring the < and > characters are removed.
    def singleLineTextField = customFields.find { it.name == '<SpecifyTheCustomFieldNameHere>' }?.id
    def numberField = customFields.find { it.name == '<SpecifyTheCustomFieldNameHere>' }?.id
    def singleSelectListField = customFields.find { it.name == '<SpecifyTheCustomFieldNameHere>' }?.id

I couldn't find it anywhere (I admit, I am not a JIRA developer, so scripting is not my thing).

Could anyone (Kristian?) please let me know how it would look like? Also, in that example script Kristian was clearing "Comments" field without defining it in the def section. Do I treat "Sprint" filed the same way, as both of them are default fields.  

I would greatly appreciate any help I could get. Thank you in advance.

1 answer

1 accepted

0 votes
Answer accepted
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.
October 6, 2022

Hi Gregory,

I can confirm that I have updated the snippet linked above so that it clears checkbox fields and the sprint field now.

Please note in Jira the sprint field is treated as a custom field so the script gets this on line 27 and gets the checkbox field on line 26 where you must specify the name of your checkbox field.

These are then set to null in the body of the rest call on line 30 to clear the values.

In the body of the clearValues rest call you can comment out any fields you do not wish to clear.

I hope this helps.

Regards,

Kristian

Gregory Kremer
Contributor
October 6, 2022

@Kristian Walker _Adaptavist_ Thank you so much. I'll give it a try and let you know how it goes. Appreciate all your help.

Gregory Kremer
Contributor
October 6, 2022

@Kristian Walker _Adaptavist_ 

Kristian,

This thing worked like a charm. I truly appreciate your assistance. You are the best.

Like • Kristian Walker _Adaptavist_ likes this
Gregory Kremer
Contributor
November 8, 2022 edited

No comments. Sorry.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events