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 Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,335 views 14 20
Join discussion

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot