How to update Summary field from a custom field on issue create transition?

I have set up project that only has one issue type.  This is a custom issue type that collects only specific information.  The Summary field does not make any sense in this context.  I understand that the Summary field is a mandatory field and can't be hidden.  So, I have pre-poluated the field with the words 'Will be populated by post function' and moved it to the bottom of the create screen.  Only the required custom fields are displayed on the create screen - all the other normal JIRA fields have been hidden.

In the workflow, I have a post function under the create transition, to update the Summary field.  This works well for static content using a Custom script post-function with just the following:

issue.summary = "static content";

However, when I try to read the value from a custom field and use that to write to the Summary field, it doesn't work.  I've tried the following variations, and both before and after 'Creates the issue originally. ' with no success.

def newSummary = issue.getCustomFieldValue(11310)?.getValue();
issue.summary = newSummary;
def newSummary = issue.getCustomFieldValue(11310);
issue.summary = newSummary;

What am I missing?

2 answers

What error are you getting? It might be that the ticket was not actually really created and at this point because the "Summary" is required, the value of that Custom Field is not yet populated. Put a static content in and try to update it later after the ticket is really created.

As I mentioned, I am pre-populating the summary field with default static content. It is with this default content that the issues are created with. The issues are created successfully. However, I am attempting to re-write the summary field using a post function. This is also successful if I use static (but different) content. What I need to do is to read the value from a custom field and use that to re-write the summary field.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Monday in Jira Software

How large do you think Jira Software can grow?

Hi Atlassian Community! My name is Shana, and I’m on the Jira Software team. One of the many reasons this Community exists is to connect you to others on similar product journeys or with comparabl...

581 views 6 12
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you