Best way to silently update a custom field when a JIRA issue is created?

Nathan April 30, 2013

I have a custom field that I use for reporting called "Original Project" that my users are populating when they create a JIRA issue. They populate it with the Project they are creating the issue in.

However, I'm able to derive this field based on the Project the user creates the issue in, so why have the user fill it out? I'm wondering how I can just silently update this field in the background based on the Project.

I looked at using a Post Function, but none of them seemed to be "Update a custom field based on the Project".

I could add an event, then add a listener to the event... is that the best way to silently set a custom field based on other info?

Thanks!
--

Nathan

1 answer

1 accepted

1 vote
Answer accepted
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 30, 2013

As you've already worked out, you'll need to find or write a plugin to do this. You'll need to choose between post-function and listener as well.

Post-functions run only on transitions, are relatively easy to write, and can be placed in a way such that they only ever run when they are needed. Listeners are more flexible as they can catch any event. (Your comment about "adding an event" needs a bit more info - events are already fired, and it's one event per thing-that-happens, so you probably don't need to worry about adding another one - you've already got "create issue" events happening and you can't add a second event)

On the back of all of that, I'd seriously recommend a look at the script runner plugin. It can bypass the need for another plugin in both cases above and can be a lot more flexible than hard-coding a plugin...

Suggest an answer

Log in or Sign up to answer