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

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?

0 votes
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
Community showcase
Published Nov 29, 2018 in Jira

How to set up an incident workflow from the VP of Engineering at Sentry

Hey Atlassian community, I help lead engineering at Sentry, an open-source error-tracking and monitoring tool that integrates with Jira. We started using Jira Software Cloud internally last year, a...

1,089 views 0 8
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