Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
badges earned

Your Points Tracker
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Populate summary field with static text + values from custom field


My knowledge of scripting is very limited. I've been doing mostly configurations and automations in our JIRA based on pre-built functions or JQL.


I am looking to populate the summary field for a certain request type with some static text + values from two custom fields.

Its a form for "Create New Employee". I dont want the users input on the summary, I want it standardized. Today i've just hidden the summary and preset the value to "Create New Employee".

Since we are growing quite a bit, it can now be problematic to have a bunch of requests with the summary "Create New Employee without knowing which one is for which user.

Therefore I would like to also populate the summary with the custom field "Name" and custom field "Surname" as well as the static text so the summary after creation will be "Create New Employee - name + surname".

I've searched around, but most of the answers just states that you can use Scriptrunner / Behaviours for that, but no mention on how to do it.

I tried to understand it, but it just doesnt makes sense to me.

Can anyone help me with a groovy script for this so I can create a behaviour for this. It would also be incredibly helpful with some "help comments" on each step so that I can try to understand and learn why you're doing this or that, so maybe I can learn how to do this myself in the future.


3 answers

2 accepted

1 vote
Answer accepted

Hello @Stian Bentsen Sveen

Are you using service desk?

As i understand the user must fill customfields name, surname and this info must be added to summary field, Am I correct?

Hi Mark, 

Yes that's correct, they fill in those fields in the form (required fields) and if possible I'd like that information to be populated in the summary along with the static text when the issue is created.


Edit: and yes we use service desk

Behaviours work on front-end side. It means that when users fill fields, summary field on screen will change dynamically. And this is means that users can change the summary after it fills automatically. If you need to change summary without users notice that, will be prefer to use @Gezim Shehu method with some corrections.
Behaviours preferable to use for set defaults for fields, like in this example

(also recommend you to check this article about how to create behavior from the start

And to set field defaults in service desk, you need to create behaviour with mapping to service desk like this

Снимок экрана 2018-07-18 в 0.36.37.png

Then click on fields and Create Initialiser with code like this

getFieldById("summary").setFormValue("New Employee")

This is will fill summary field with "New Employee" value and your user will not need to fill this field.

After this you can use @Gezim Shehu [Communardo] postfunction to add usernames to summary field.

Thanks @Mark Markov,

What we've done for each service request type is to hide the summary field with the value preset to the request type so the users dont have to fill in anything there, just the custom fields / description added to each form. This is because from experience, some users start writing the hole request in the summary field, incorrect info there etc (this is for internal IT support in our company).



The only issue type they can choose summary for is incidents as there only one form for that since IT does all the categorizations since users usually dont know what the cause of the incident is.

Would it be better to change this and create behaviors for this instead that populates the summary field for each request type?

For the requests where we will try to use scripting to add additional values to the summary it doesnt make sense to set a preset value on the request form if we have scripting that will replace it anyway.

1 vote
Answer accepted



Though I disagree with the "categorization" by summary, the actual automatic summary is a good approach.


You can surely do it in a lot of ways, but most propably in a post function during create transition. You need to add a custom script post function into the desired workflow (custom script post function - part of Script Runner)

Now here's the tricky part:

  • If you have your field configuration configured that Summary is required., which I assume you have as that's the default basically, you would need to add the Post Function at order 1, above the Create Issue post function.
  • There's also the option that your field config does not care about the summary and you can put the post function last (i'm only mentioning this since most cases you would put the post function at the last order)


Now if you got to this part, the script would look something like this

(I will try to write in details, not shortening, so you can follow the logic)


import com.atlassian.jira.component.ComponentAccessor

def customFieldManager = ComponentAccessor.getCustomFieldManager()

def myCustomField1 = customFieldManager.getCustomFieldObjectByName('Name of custom field 1')

def myCustomField2 = customFieldManager.getCustomFieldObjectByName('Name of custom field 2')

//if you have fields with same name, which btw bad practice, you can also use getCustomFieldOBjectById

//get values, you could also do it in 1 line

def value1 = issue.getCustomFieldValue(myCustomField1).toString()


String value2 = issue.getCustomFieldValue(myCustomField2)

//set summary

def concatValue = "New Employee:" + value1 + value2





Hi Gezim, 

Thank you so much! 

I'll look at this first thing tomorrow morning.

It's not as much categorization as it is an easy way of differentiating between multiple "New employee" tickets. They could just edit the request and include the name in the summary, but it would be even better to automate it.

If I can learn this that also mean I can probably do tons of other things with similar scripting, which is just what I'm after. :) 

@Mark Markovalso has a good point. Behaviors would be my choice also, since in your case you have already defined a default value for the field.


Though issue is that you would monitor 2 custom field for changes.

Also it would require 2 updates, that's why I suggest you remove even the default one and add a post function at the top of the order to populate it. This way it would show up within the create event, just as that was the original user's input.


Events/Updates are always worth saving/grouping.



 @Gezim Shehu [Communardo] Thanks, I got it working with your script and with @Mark Markov input using behavior for default values as well.

Without using behavior to set a default value I got an error on creating because summary wasnt populated, even though I added the post function at the top of the order list (as you mentioned in the "tricky part").

I understand a bit more know and I guess using this in other contexts is just finding out which libraries I need to import and which commands / fields to use (easily explained ;) ).

Now I just need to figure out the "if" clause to make this only apply for request type "Create New Employee" so it doesnt set this summary for all request types using that workflow, hehe.

Thanks for the help, both of you!

Hi @Stian Bentsen Sveen,


I remember also having troubles with getting the Service Desk request names.

By default, using only normal methods to retrieve the value from Customer Request Type custom field, you would get the key, instead of the name.

Key looks something like this:



Here's a little script that gets the name of the Customer Request Type, using the Service Desk API;


//service desk apis to get name instead of key value
import com.atlassian.servicedesk.api.requesttype.RequestTypeService
import com.atlassian.servicedesk.api.requesttype.RequestType
import com.onresolve.scriptrunner.runner.customisers.PluginModule
import com.onresolve.scriptrunner.runner.customisers.WithPlugin



RequestTypeService requestTypeService

//set Jira Robot as logged in user
def authContext = ComponentAccessor.getJiraAuthenticationContext()
def userKeyToSet = 'robot'
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()

RequestType getRequestType = requestTypeService.getRequestTypeForIssue(currentUser, issue).right().get()
String requestTypeName = getRequestType.getName()

@Gezim Shehu [Communardo] Yeah, I remember having some issue with that a while ago. I just went into the DB and found the key and tested with the if clause and it works great!


Thank you so much for your assistance and the extra script for customer request type name is perfect as well!



Np. Glad to help

Is there any way to do this outside of using Script Runner? For us that would be over $700 a month to utilize that tool. 


I basically want to do (CE-Eventname-Username) as the summary field. CE would be static text, and eventname and username are required input fields. 




Thanks everyone!

hello @Brian Manning di you find the solution to your issue because I have the same needs for similar approach but for other field.

Did you find a way to do without using script runner for instance ?


No, unfortunately, this was a bit of a dead-end without having to spend a bunch of money for a one-use plugin.

I manage to do that using Automation for Jira for my customer

would you mind sharing how you did this? 

The way I test it for instance is that I have a service desk request when I need to create a new account for a user.

When the request is created , it create 2 sub task attached to the TSD request.
using automation I set the description field of the fisrt task by getting the user name using smart value syntax


In the mean time I add an Edit issue field function to edit the summary field of the issue which will add the user name in the same way



I wanted to update the summary field with the fields "first name" + "last name"

this is the script I ran in automation


"New User Access request for - {{issue.First Name}} {{issue.Last name}}"


New User Access request.jpg

Works a treat:)


Suggest an answer

Log in or Sign up to answer

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you