I have a project "IT Checklist" with issue types as Daily Checklist, Weekly Checklist.....Yearly Checklist.
I have a behaviour which sets the summary based on the issue type selected and the date selected.
The behaviour is working fine on Create issue screen but is not working on Edit issue screen.
This behaviour is set of Issue Type field and has a mapping for each of the issue types of this project.
IT Checklist (Daily Checklist)
IT Checklist (Weekly Checklist)
etc...
The script is as below:
import com.onresolve.jira.groovy.user.FieldBehaviours
import com.onresolve.jira.groovy.user.FormField
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.*
String selectedIssueType = getIssueContext().getIssueTypeObject().getName();
FormField checklistDateField = getFieldById("customfield_16706")
def checklistDate = checklistDateField.getValue();
def summaryToSet = selectedIssueType + " - " + checklistDate;
FormField Summary = getFieldById("summary");
Summary.setFormValue(summaryToSet)
As you can see, I am using getIssueContext().getIssueTypeObject(), which according to the few previous answers I went through should be available on both Create and Edit screens. However, it doesn't seem to work.
Will appreciate help.
An update.
Just discovered that the script is not even working on Create screen. I just realised that I was getting desired summary not because I changed issue type, but because it loads full form and I have similar script on another field (Date).
I essence, above script is not working either on Create or Edit.
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.