Customfield value to Summary upon Create

Anders Johnsgaard August 8, 2019

Hi,

I have no skills when it comes to scripting, but I'm trying to add text to the summary-field based on my input to a customfield (customfield_10136).

The customfield displays a single select Insight objects Name-attribute.

I want the summaryfield to spell "Audit: <my inputvalue from cf>"

 

So far I get the field to spell out "Audit: " and the KEY for the Insight object, but not the actual Name of the object.. 

I've gotten lost in scriptrunner and behaviour, and tried Automation for Jira, Custom script Postfunctions for Create in the workflow, and various articles the might look a bit like what I'm trying to achieve, and now I'm just confused and dizzy.

 

In the behaviour: I've put this in the initializer, customfield and summaryfield (copied it from an article and modified slightly.... have no idea if/which of the first 5 lines are even needed)

 

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 CR = getFieldByName("Kontrollrom").value
def summary = getFieldById("summary")

 

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

 

 

Result in Sumamry field is

Audit: TES-125 

TES-125 is the Key for the insight object I selected upon filling out cf, during Create.

 

Any pointers on get it to show the attribute "Name" instead of "Key"?

0 answers

Suggest an answer

Log in or Sign up to answer