Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Automation script that live-updates Summary over to Epic Name field

Johnson Wang March 3, 2020

PROBLEM

For Epic issue types, users currently need to manually input twice the same text for both the Summary and Epic Name fields.

DESIRED SOLUTION

As the user is inputting in the Summary field, the Epic Name field live-copies the value over so that the user immediately sees the effect.

  • JIRA Server environment
  • Ideally want to implement using ScriptRunner (and Behaviors?)
  • I know this can be done using a workflow Post-Function but I think the UX is poor as the user still needs to enter something into the Epic Name field before it gets overwritten after issue creation

1 answer

1 vote
PD Sheehan
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.
March 3, 2020

Hi @Johnson Wang 

This can be implemented with scriptrunner behavior.

But there are a few questions to answer that might impact the complexity of the solution.

  1. Do you ever want the users to be able to change one and not the other? What are the cases when this should be possible?
  2. Should the same behavior take place when editing an epic's summary after initial save?

Here is generally how to proceed:

  • Create a behavior configuration and add a mapping to the specific project and in this case, only Epic issue type.
  • Then in the fields area of the behavior configuration, add the Summary field.
  • In the summary field, add a server-side script.
  • The simplest approach would look like this in the server-side code block:
def epicFld = getFieldByName('Epic Name')
def summaryFld = getFieldById('summary')

epicFld.setFormValue(summaryFld.value)

This simply sets the epic name to the value of the summary each time the summary field content is changed. You will only see the effect when you change focus from the summary field.

In theory, you can now change the Epic Name to something else and submit the form. But the next time the edit form is open, if the epic name field is available, it will be updated when Jira populates the form with values from the db and reset any manual entries.
That's why I said it could get complicated. If that's a possible scenario for you, then you need to code in some rules when to and when not to update the epic name (such as only update the epic name if there the value stored in the db is empty or doesn't yet exist).

I hope that helps.

Suggest an answer

Log in or Sign up to answer