Bulk Delete/Remove Custom Field Values

Hi,

ScriptRunner has ability to import custom field values in bulk (https://scriptrunner.adaptavist.com/4.3.6/jira/builtin-scripts.html#_bulk_import_custom_field_values) but I need to remove/delete all of the custom field values - any way to do this with ScriptRunner (maybe running script from Script Console)?

Thanks for help in advance!

2 answers

This widget could not be displayed.

Any way of doing this that doesn't involve deleting field values one by one?

Have you found any solution for removing field values one by one?

This widget could not be displayed.
Gaston Valente Community Champion Jul 18, 2017

Hi,

I'm sorry if i don't understand the question but what about a groovy scriptrunner script to do a jql query to obtain all issues with values at the particular field and then do and then set the value to null on this fields?

i think i have an snippet to do that

 

Is it not possible to do in simple Java and not in groovy?

Gaston Valente Community Champion Jul 18, 2017

Yes, of couse, but you need to create a custom service i think.

You need to download the sdk, create an skeleton of jira plugin, add your login and then install the plugin in your instance.

It's more work, the code should look very similar.

 

okay, i will try jql query to search the issues and the label with the values. Thanks for the help.

Gaston Valente Community Champion Jul 18, 2017

Here you can find great examples:

https://jamieechlin.atlassian.net/wiki/spaces/GRV/pages/1212431/Miscellaneous+Groovy+Scripts

"Executing a Query"

package examples.docs
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.search.SearchProvider
import com.atlassian.jira.jql.parser.JqlQueryParser
import com.atlassian.jira.web.bean.PagerFilter

def jqlQueryParser = ComponentAccessor.getComponent(JqlQueryParser.class)
def searchProvider = ComponentAccessor.getComponent(SearchProvider.class)
def issueManager = ComponentAccessor.getIssueManager()
def user = ComponentAccessor.getJiraAuthenticationContext().getUser()

// edit this query to suit
def query = jqlQueryParser.parseQuery("project = JRA and assignee = currentUser()")
def results = searchProvider.search(query, user, PagerFilter.getUnlimitedFilter())

results.getIssues().each {documentIssue ->
log.debug(documentIssue.key)

// if you need a mutable issue you can do:
def issue = issueManager.getIssueObject(documentIssue.id)
// do something to the issue...
log.debug(issue)
}

 

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

216 views 3 0
Join discussion

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