Hi,
I have added a behavior for setting default questions in to few fields based on other field value, Ever thing is working fine on create screen but when I click edit on the issue the behavior runs again and it erases the answers entered while creating issue. Now i want to runt this behavior with other condition i.e, it should run only when we edit the field value.
I have found similar (https://community.atlassian.com/t5/Jira-questions/Execute-behavior-only-when-specific-field-is-changed/qaq-p/26347) requirement which was answered by Thanos Batagiannis [Adaptavist] But i am unable to render the info from a field and compare it.
-----------------------------------------------------------------------------------------------
Script:-
import com.atlassian.jira.issue.fields.rest.json.beans.IssueRefJsonBean
import groovy.json.JsonBuilder
//-------------------------------------------------------------------------
// This script hides fields and shows them based on the value of a
// single select custom field.
//-------------------------------------------------------------------------
def currentTypeofRequest = getFieldByName("Type of Request").getValue()
def typeOfRequestcf = getFieldByName("Type of Request")
def Summary = getFieldById("summary")
def Description = getFieldById("description")
def fields = [
"None" : [
"summary" : "",
"description" : ""
],
"JIRA Integration" : [
"summary" : "",
"description" : """1. Please provide the name of your JIRA project(s) you wish to integrate with Aha?
2. Please specify if you would like to import, release, epics and stories?
3. Is your project use the standard Tesco JIRA workflow?
4. Is your JIRA project shared with other Product Managers?"""
],
"Access Request / Permission Change" : [
"summary" : "",
"description" : """1. What is your email address?
2. Please specify if you require ‘edit’ or ‘review’ access and for which product
3. What is your job role?
4. Please Provide the product name? """
],
"Ideas Portal" : [
"summary" : "",
"description" : """1.Please provide the product name you wish to add an ideas portal to """
],
"New Product" : [
"summary" : "",
"description" : """1. Please provide the product name?
2. Please provide the name of your line manager.
3. Please provide the email addresses of colleagues who require permissions to create epics, releases and stories.
4. If you require JIRA integration, please specify your project name """
],
"Other Customisation" : [
"summary" : "",
"description" : """1.Please provide an explanation of the customisation you require. E.g. custom report…… ?
2.Please attach any documents that will provide clarity? """
]
]
typeOfRequestcf.setRequired(true)
Summary.setHidden(true)
Description.setHidden(true)
fields."${getFieldByName("Type of Request").getValue()}".each {
if (getFieldByName("Type of Request").getValue() != null) {
typeOfRequestcf.clearError()
field = getFieldById(it.key)
field.setHidden(false)
field.setFormValue(it.value)
} else {
fields."None".each {
field.setFormValue(it.value)
field.clearError()
}
}
}
--------------------------------------------------------------------------------------------------
Ref:-
Hi @Nikhil ,
try to add the script to the specific field its depends on and not as initialiser
I have added it to the specific field itself but the issue is when i click edit screen it shouldn't wipe out the changes i made on create screen until i change the type of request field.
Regards,
Pavan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.