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,558,887
Community Members
 
Community Events
184
Community Groups

Behaviours: How to get value from Request Type hidden field?

Hi.

I have two fields:

  • Product
  • Component/s

I have the following code which sets Components based on Product field if the product fields is visible in the Portal Form. This works fine.

2020-03-30_18-13.png

Behavior on field Product:

// Sets components per product
import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript

import static com.atlassian.jira.issue.IssueFieldConstants.COMPONENTS

@BaseScript FieldBehaviours fieldBehaviours

def customFieldManager = ComponentAccessor.getCustomFieldManager()
def optionsManager = ComponentAccessor.getOptionsManager()
def projectComponentManager = ComponentAccessor.getProjectComponentManager()

def productField = getFieldById(getFieldChanged())
def productOption = productField.getValue() as String

def issueTypeField = getFieldById(COMPONENTS)
def components = projectComponentManager.findAllForProject(issueContext.projectObject.id)
def availableComponents = []

if(productOption == "Infinity Fabric"){
availableComponents.addAll(components.findAll { it.name in ["App Server Console","App Viewer","Data Adapters",\
"Developer Portal","Engagement","Engagement Console","Enterprise App Store (EAS)","Environments","Identity Services",\
"Installer","Integration Services","Legacy Services","License Activation","Logic","Management Console",\
"MF Console","Object Services","Offline Sync","Orchestration","Publish (publishing services for desktopweb/spa)",\
"Reports","RTL","SDK","Security","Sync","Sync Server Console","User Management"] })
}
else{
availableComponents.addAll(components.findAll { it.name in ["Other"] })
}

issueTypeField.setFieldOptions(availableComponents)

 

When I hide the field with Preset Value, the above does not work.

2020-03-30_18-16.png

2020-03-30_18-18.png

 

Please can you advise how can I get value for the hidden field that my behavior script can set Components based on the Product (hidden value)?

Thanks.

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events