Get event details from CustomFieldCreated/Updated/Deleted events with Script Runner?

Trevor Hunt
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 7, 2016

Subject says it all. I'm building a custom listener with Script Runner that notifies a slack Channel when custom fields are created. I have a listener sending basic notifications when custom fields are Created, Deleted, and Updated but I'd like to enrich the notification with details such as the field name and who made the change.

Eventually I'd like to roll this to workflow and projects events.

@Jamie Echlin [Adaptavist], @Nic Brough [Adaptavist] any thoughts on this one?

1 answer

0 votes
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 7, 2016

Did you check out the javadoc: https://docs.atlassian.com/jira/latest/com/atlassian/jira/event/issue/field/CustomFieldUpdatedEvent.html ?

Surprising, I can't see the actioning user there... most events let you get the user that did it.

So for the examples above, you can get the cf name with:

event.customField.name

 

 

Trevor Hunt
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 7, 2016

I did look there but didn't see anything that told me it should be ".name".

Trevor Hunt
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 7, 2016

I guess what was throwing me is that the inline script editor shows an error when I use the example above... "No such property: Name"... specifically:

groovy.lang.MissingPropertyException: No such property: name for class: com.atlassian.jira.event.issue.field.CustomFieldCreatedEvent

The above example still generates the error above.

Rafael Franco
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 20, 2016

Trevor by the looks of the API you need:

 

event.customField.fieldTypeName

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events