The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
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")
.asObject(List)
.body
.findAll { (it as Map).custom } as List<Map>
def toUpdate1CfId = customFields.find { it.name == 'Compliance Risk' }10257
def toUpdate2CfId = customFields.find { it.name == 'GDPR Risk' }10258
def toUpdate3CfId = customFields.find { it.name == 'Business Risk' }10259
def toUpdate4CfId = customFields.find { it.name == 'technical Risk' }10432
def toUpdate5CfId = customFields.find { it.name == 'Compliance Prio' }10260
def toUpdate6CfId = customFields.find { it.name == 'GDPR Prio' }10261
def toUpdate7CfId = customFields.find { it.name == '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')
.body([
fields: [
(toUpdate1CfId): 'NULL',
(toUpdate2CfId): 'NULL',
(toUpdate3CfId): 'NUKK',
(toUpdate4CfId): 'NULL',
(toUpdate5CfId): 'NULL',
(toUpdate6CfId): 'NULL',
(toUpdate7CfId): 'NULL'
]
])
.asString()
assert resp.status == 204
Also, defined the trigger as seen in the screenshot.
Do you have any experiences on this? Any advice how to make this work?
Thanks a lot!
Best,
Xheneta from Munich
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 :- https://community.atlassian.com/t5/Jira-Service-Management/How-to-use-automation-to-clear-date-value-on-change-of-status/qaq-p/1525817
Thanks
V.Y
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.