Hi,
I'm trying to use Script Post-Function [ScriptRunner] to create the summary of an issue based on the customers' answers in other custom fields.
Jira claims the script has no errors, and that all the issues I submit are passing this script. I am unable to see any logs which show why this is not working, however.
Mind you, I am very new to this scripting-business.
Why is this seemingly running fine - but not updating the "Summary" (nor giving me any log.info I write)?
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.worklog.WorklogImpl
import com.atlassian.jira.event.type.EventDispatchOption
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def cfKommune = customFieldManager.getCustomFieldObject(12009)
def cfGnr = customFieldManager.getCustomFieldObject(12200)
def cfBnr = customFieldManager.getCustomFieldObject(12201)
def cfAdresse = customFieldManager.getCustomFieldObject(12202)
def cfKortBeskrivelse = customFieldManager.getCustomFieldObject(12209)
if (issue.getIssueType() == "Ny tilknytning/forsterkning") {
String kommune = issue.getCustomFieldValue(cfKommune)
String gnr = issue.getCustomFieldValue(cfGnr)
String bnr = issue.getCustomFieldValue(cfBnr)
String adresse = issue.getCustomFieldValue(cfAdresse)
String kortBeskrivelse = issue.getCustomFieldValue(cfKortBeskrivelse)
def newSummary = kommune + " - " + gnr + "/" + bnr + " - " + adresse + " - " + kortBeskrivelse
issue.setSummary(newSummary)
log.info(newSummary)
}
I decided to use Automation for Jira instead, as it proved to be MUCH easier (and I had forgotten about the use of smart values there, as it's not always clearly mentioned).
It's working as expected now - and the script above is in the bin.
Where is this script being run?
As an aside, I would not recommend doing this. You're destroying data that the customer took time to enter, that's rather annoying for them. Also, the summary may not be big enough to hold everything (I can't tell from the scripts if your data might be too long). I'd recommend using a separate custom field if you really need this string built.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, this was being run in the workflow from Create to the first status.
I decided to use Automation for Jira instead, as it proved to be MUCH easier (and I had forgotten about the use of smart values there, as it's not always clearly mentioned).
It's working as expected now - and the script above is in the bin.
To explain the usage: the summary field was never really used for this customer request type, as the data my company needed is their county, address, and "lot ID" numbers. The customer enters these details in various custom fields, and it is still available in the custom fields after, but is also combined into the summary upon submission. This way my company gets an overview over work being done in/at various counties/addresses without digging through or displaying various custom fields. It makes each issue very easily recognisable.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.