Forums

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

Copy only a part of the description field to summary field

Tiffany Owen
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.
January 31, 2018

Background info: (we wish the Summary field was not required by Jira, but since it is we have to work around it somehow. Ideally, we just want the Description field with the Summary being a shortened version of the Description field.)

For our specific uses, on the Issue Create screen, we have the Summary field set to hidden. Currently, we are using the Jira Suite Utilities add-on and use it as post-function when the issue is created to copy the Description field value to the Summary field value.  However, sometimes the description entered by the customer is way too long and we only want about the first 100 characters of the description field to copy to the summary, sort of as a 'preview'.

For example, if the Description entered by the customer is: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum", we need the summary to be just the first part; something like: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt..." with possibly the 3 trailing dots at the end to indicate that there is more.

Is there a way to do this? We have ScriptRunner, but have not learned how to use it yet. I have no idea what kind of script I would need to write. Any help in the right direction is much appreciated.

2 answers

1 accepted

0 votes
Answer accepted
Tiffany Owen
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.
February 1, 2018

Thanks for the reply! We DO use the summary field, we just don't require our customer to have to enter it - we auto-generate it for them. Our reasoning for this is that in our current ticketing system, it worked this way - the user just enters their description and our queue displays a snippet of it as the "summary" when filtering through tickets (see below).

description.PNGsummary.PNGA part of the decision factor to switch to Jira SD is that we don't make our customers fill out more than they have to. To "us" the description and summary serve the same purpose.

Solution: I was able to accomplish this by setting a default value for the Summary field (i.e. just something like 'service request'), then I set the Summary field to Hidden on the customer portal. On the workflow during the Issue Create transition, using the Jira Suite Utilities add-on, I created a "Copy a parsed text to a field" post-function. I just captured the first 90 characters of the description field, added an ellipsis at the end, and overwrote the Summary field with the result. It works flawlessly.

substring(%{00001}, 0, 90) + "..."

description_summary.PNG 

0 votes
Nic Brough -Adaptavist-
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.
January 31, 2018

Well, my opinionated answer is "you should use the summary field, it's there for a good reasons and most people find it useful as implemented".  Humans like headlines to help them filter information quickly.  That's why it's the only mandatory field!

So, let's move past the opinion and try to help:

Yes, Script Runner can help you with this.  There are two routes you could take though, and it's worth deciding which one to take (so I don't have to explain both in detail!).  The decision here is based on a choice about editing.

Simply - once you have created an issue (with an extracted summary), do you want the summary to continue to mirror your extract or not?  Imagine you have an issue with a description of "Mr Flibble is very cross", so you extract "Mr Flibble is very cross" when it is created, do you want to change the summary when a user changes the description to "Mr Flibble has left the ship"?

If you do not want to change the summary, then you have the slightly easier route of writing a post-function on the create transition that does the extract and write.

If you do want to regenerate the summary, then you will need a listener to pick up any changes to description and regenerate it.

Either way, a couple of starting points:

  • You will still need to put a summary on the create screens.  Jira requires it.  Your users will have to enter something, and then you'll need to educate them that whatever they enter, your code is going to discard as useless.
  • Remove the summary from all your screens that are not create screens, then your users won't be able to scrub your calculated summary
Tiffany Owen
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.
February 1, 2018

I posted my reply as an Answer in case anyone else can benefit from it. Thanks!

Suggest an answer

Log in or Sign up to answer