Customfield value attribute to Summary field

Anders Johnsgaard August 8, 2019

Hi,

 

I have a customfield "Kontrollrom" and I would like the input from this field to be copied to the Summary field, upon issue creation.

The cf is a insight object field, (name of the object is shown).

I have this script that I use in the Behaviour, but it only gives me the KEY for the object, not the NAME-attribute.

Any pointers on how to extract the name-attribute?

 

import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
import static com.atlassian.jira.issue.IssueFieldConstants.SUMMARY

@BaseScript FieldBehaviours fieldBehaviours

def system = getFieldByName("System").value
def CR = getFieldByName("Kontrollrom").value
def summary = getFieldById("summary")




summary.setFormValue("""Audit: """ + "${CR}")

 

1 answer

1 accepted

0 votes
Answer accepted
Gael Motte [ Spectrum Groupe ]
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 9, 2019

Hi @Anders Johnsgaard

 

Here is a link to Riada's documentation regarding calling thier JAVA API to get object bean, hence, values.

https://documentation.riada.io/display/ICV53/Load+Object+by+Key

 

You might want to do that in script post function on create transition, because it may slowdown the UI in a behavior.

 

Cheers

Anders Johnsgaard August 13, 2019

Hi,

Thanks.

Yes, i've been trough this, but can't seem to get it to do what I want:)

 

Anyway.

Solved it by Autofilling Summary with the text i wanted ("Audit: "), using 

def sum = getFieldById("summary")


def defaultValue = """Audit: """.replaceAll(/ /, '')

if (!underlyingIssue?.summary) {
sum.setFormValue(defaultValue)
}

 

Then I used Copy Value From Other Field (JSU) - 

  • Copy Field Kontrollrom to: Summary , append

on the create transition post function.

 

Works like a charm, but probably not optimal:)

 

Br,

Anders

Suggest an answer

Log in or Sign up to answer