Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Clear fields via listeners

Hi all,

I am trying to use listeners to clear the field value for some fields as soon as the issue gets updated.

The fields which I want to have cleared are in another tab. Nevertheless, I have listet them as below. 

// get custom fields
def customFields = get("/rest/api/2/field")
.findAll { (it as Map).custom } as List<Map>

def toUpdate1CfId = customFields.find { == 'Compliance Risk' }10257
def toUpdate2CfId = customFields.find { == 'GDPR Risk' }10258
def toUpdate3CfId = customFields.find { == 'Business Risk' }10259
def toUpdate4CfId = customFields.find { == 'technical Risk' }10432
def toUpdate5CfId = customFields.find { == 'Compliance Prio' }10260
def toUpdate6CfId = customFields.find { == 'GDPR Prio' }10261
def toUpdate7CfId = customFields.find { == 'Business Value' }10262

def tomorrowStr = (new Date() + 1).format("yyyy-MM-dd'T'HH:mm:ssZ", TimeZone.getTimeZone("UTC")) // date format in iso8601
def resp = put("/rest/api/2/issue/${issue.key}")
.header('Content-Type', 'application/json')
fields: [
(toUpdate1CfId): 'NULL',
(toUpdate2CfId): 'NULL',
(toUpdate3CfId): 'NUKK',
(toUpdate4CfId): 'NULL',
(toUpdate5CfId): 'NULL',
(toUpdate6CfId): 'NULL',
(toUpdate7CfId): 'NULL'
assert resp.status == 204

Also, defined the trigger as seen in the screenshot.

Screenshot 2022-05-05 at 11.19.15.png

Do you have any experiences on this? Any advice how to make this work?

Thanks a lot!


Xheneta from Munich


1 answer

Hi @Xheneta G_ Hyseni  I am not sure how script runner listner works in JIRA cloud. But an alternate solution is that you can use Project Automation to clear field value when issue is updating. 

Similar post :-




Hi @Vikrant Yadav ,

That does not really work in my case since I got a a few fields to update unfortunately. I already tried it with automations first. 

Thanks anyway!

Suggest an answer

Log in or Sign up to answer

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