Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Auto-populate description (or preview) based on scripted field

Current situation:

Transition screen with a scripted field (issue picker) "Existing Reported Issue", and a 'normal' custom field "Public bug description":

Schermafbeelding 2021-01-12 om 12.15.56.png

Is it possible to auto-populate "Public bug description" based on the issue picked at "Existing Reported Issue"?

So, for example:

- chosen "Existing Reported Issue" has description "XYZ"

- Public bug description will be auto populated "XYZ"

- if another Existing Reported Issue is chosen, the Public bug description will be "overwritten".

If that's not possible, some kind of preview of the Description field is also fine.



1 answer

1 accepted

Hi Berry,

You can achieve this with setFormValue() in Scriptrunner Behaviour.

Here's the sample script which is applied in Behaviour > Fields > (Your issue picker field):

def issuepicker = getFieldById(getFieldChanged()) 
def multitext = getFieldByName("Multi Text Field")

//Get the issue picker field's value
String issuepickerValue = issuepicker.getValue()

//To check the issue picker field's value in logs
log.error("issuepickerValue: $issuepickerValue")

if (issuepickerValue == "SUN-5") {
}else if (issuepickerValue == "SUN-6") {

You can refer to this document for more information on adding a default description with Behaviour. 

Hi JJ, thanks for the info!

However, I'm still a bit stuck in the implementation. Is it possible to have a quick screen share session?

Cheers, Berry.

Hi Berry,

Apologies that we can't have a screen share session regarding the issue. 

But you can attach the screenshots with the explanations on where you’re stuck with. I'll take a look at it when I'm available.

No problem. To be honest, I'm really a noob concerning Behaviours, so I "just" copy/pasted your script with minor adjustments. Not sure what to do next..

See the video at:


You're almost there. You'll need to change the "SUN-5" and "SUN-6" to the issue keys that have been selected in your Issue Picker field.

Just some minor changes for this part:

//If you've selected "RI-5162" in your issue picker field
if (issuepickerValue == "RI-5162") {
multitext.setFormValue("RI-5162 - test 23 dec 3")
}else if (issuepickerValue == "RI-5163") { //If you've selected "RI-5163" in your issue picker field
multitext.setFormValue("RI-5163 - test 23 dec 4")

Also, in the Behaviour Mappings please choose "Use project/issuetype mapping" mapping type. The service desk mapping type should only trigger the behaviour on the customer portal. 

Hope this help! 

Thanks, Unfortunately I still do not see the expected behavour:

One more question as I don't exactly understand why/how I should change the mentioned issue key's in the script. Because it could be any random issue key that people will select in the field Existing Reported Issue. 

In your screencast, I can see you're mapping to project "Reported Issues" and transition the status in the project "Uniface Service Desk".

Please try to map to the project "Uniface Service Desk" with "Use project/issuetype mapping" mapping type.

I don't exactly understand why/how I should change the mentioned issue key's in the script. 

You'll need to give a condition/command in order to customize the default value for text field based on issue picker value. The issuepickerValue stored the selected issue picker field value. So when you have got this condition in your script:

if (issuepickerValue == "RI-5162") { 
multitext.setFormValue("RI-5162 - test 23 dec 3")

If you've selected issue picker field with RI-5162, then the text field value is pre-filled with "RI-5162 - test 23 dec 3". 

But I guess you wanted to auto-populate the text field value with same as the selected issue picker value. You can just remove the if-else condition and set the text field with issue picker field value.

import com.atlassian.jira.component.ComponentAccessor

def issuepicker = getFieldById(getFieldChanged())
def multitext = getFieldByName("Multi Text Field")

String issuepickerValue = issuepicker.getValue()
log.error("issuepickerValue: $issuepickerValue")

//Get selected issue's summary based on issue picker value
def relatedIssue = ComponentAccessor.issueManager.getIssueByCurrentKey(issuepickerValue as String)

//Set multi text field value with selected issue key and issue summary
multitext.setFormValue(issuepickerValue + " - " + relatedIssue.summary)

You can refer to Adaptavist Library for more information on set form field values from issue in picker.

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events