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
Community showcase
Published Jan 08, 2019 in Jira

How to Jira for designers

I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...

1,086 views 4 9
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