The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

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

Kerrin Hardy
August 17, 2015

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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Deleted user
August 18, 2015

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.

Kerrin Hardy
August 19, 2015

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.