Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,551,796
Community Members
 
Community Events
184
Community Groups

Screen not updating when custom field values are changed

Hello, 

 

When the fields in the custom field change, I want new fields to appear depending on some selections. When I change the values, the fields I want to appear do not appear on the screen and also the fields belonging to the old selection do not disappear from the screen. I can't figure out if the code is completely broken or what is missing.

 

Thanks for help.

Ekran Alıntısı1.PNGEkran Alıntısı.PNG


import com.atlassian.jira.ComponentAccessor
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.Issue
import com.atlassian.jira.issue.context.IssueContext
import com.atlassian.jira.issue.context.IssueContextImpl
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.customfields.*
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.customfields.manager.OptionsManager
import com.atlassian.jira.issue.fields.config.FieldConfigImpl
import com.onresolve.jira.groovy.user.FormField
import groovy.transform.BaseScript

@BaseScript FieldBehaviours fieldBehaviours


import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.IssueManager;

def insightCF = getFieldById("customfield_10301")
log.warn "ingishtCF:"+insightCF


def insightKey = insightCF.getValue()
log.warn "insightKey:"+insightKey


Class objectFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectFacade")
def objectFacade = ComponentAccessor.getOSGiComponentInstanceOfType(objectFacadeClass)
def insightObject = objectFacade.loadObjectBean(insightKey)
def insightCustomFieldName = insightObject.getName()

log.warn "insightCustomFieldName:"+insightCustomFieldName

def ProjectProductInformationCF = getFieldById("customfield_11337")
def PurposeofUsageCF = getFieldById("customfield_11338")
def PurposeofUsageValue = PurposeofUsageCF.getValue().toString()
def isTrueSelected = PurposeofUsageValue == "A"

def ServerRoleCF = getFieldById("customfield_11339")
def RiskAciklamaCF = getFieldById("customfield_10608")
def RamCpuCF = getFieldById("customfield_113400")


def sethiddenfunction(){
def ProjectProductInformationCF = getFieldById("customfield_13587")
def PurposeofUsageCF = getFieldById("customfield_11338")
def ServerRoleCF = getFieldById("customfield_11339")
def RiskAciklamaCF = getFieldById("customfield_10608")
def RamCpuCF = getFieldById("customfield_11340")


ProjectProductInformationCF.setRequired(false)
PurposeofUsageCF.setRequired(false)
ServerRoleCF.setRequired(false)
RiskAciklamaCF.setRequired(false)
RamCpuCF.setRequired(false)

ProjectProductInformationCF.setHidden(true)
PurposeofUsageCF.setHidden(true)
ServerRoleCF.setHidden(true)
RiskAciklamaCF.setHidden(true)
RamCpuCF.setHidden(true)
}

if(insightCustomFieldName == "Billing Service"){
sethiddenfunction()

ProjectProductInformationCF.setRequired(true)
ProjectProductInformationCF.setHidden(false)

PurposeofUsageCF.setRequired(true)
PurposeofUsageCF.setHidden(false)

}

else if(insightCustomFieldName == "Email Service"){
sethiddenfunction()

ServerRoleCF.setRequired(true)
ServerRoleCF.setHidden(false)

PurposeofUsageCF.setRequired(true)
PurposeofUsageCF.setHidden(false)

}

else if(insightCustomFieldName == "ERP Service"){
sethiddenfunction()

ProjectProductInformationCF.setRequired(true)
ProjectProductInformationCF.setHidden(false)

PurposeofUsageCF.setRequired(true)
PurposeofUsageCF.setHidden(false)

if(PurposeofUsageValue == "A"){
//sethiddenfunction()

RiskAciklamaCF.setRequired(true)
RiskAciklamaCF.setHidden(false)
}
else{
RiskAciklamaCF.setHidden(false)
RiskAciklamaCF.setRequired(true)
}


}
else {
sethiddenfunction()
}

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events