I am trying to add a BEHAVIOR to set description with default values which i can edit before i create the ticket. And i am using the following script for it. Which work fine in bits and pieces, the not working parts comes in when i edit the ticket it erases the fields edited values and fills the default values.
so i tried a workaround by adding to the field and setting a condition to the workflow action.
Please need your help guys.
Script:-
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import groovy.transform.Field
def StoryDefaultDescValue = """Default values for story"""
def DefectDefaultDescValue =""" Default values for defect"""
def projectKey = getIssueContext().getProjectObject().getKey()
def issueTypeName = getIssueContext().getIssueType().getName()
if(getAction()?.id != 1 || issueTypeName == "Story"){
getFieldById("description").setFormValue(StoryDefaultDescValue)}
if(getAction()?.id != 1 || issueTypeName == "Defect"){
getFieldById("description").setFormValue(DefectDefaultDescValue)}
HI. Check Screen
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import groovy.transform.Field
if(getFieldScreen().name == "Project CREATE Ticket Screen"{
def StoryDefaultDescValue = """Default values for story"""
def DefectDefaultDescValue =""" Default values for defect"""
def projectKey = getIssueContext().getProjectObject().getKey()
def issueTypeName = getIssueContext().getIssueType().getName()
if(issueTypeName == "Story"){
getFieldById("description").setFormValue(StoryDefaultDescValue)}
if( issueTypeName == "Defect"){
getFieldById("description").setFormValue(DefectDefaultDescValue)}
}
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.