Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Need help with Behavior not working as expected.

Environment:
JIRA v7.4.4, 
ScriptRunner 5.3.5

Using the below, upon creation of the issue I expect the custom field (Support Forum Post Location) to only appear when one of components are selected, and then it should be required. 

What is happening is the custom field does not appear initially  on the create screen (expected) but also does not appear if I select either of the two components and try to create, the issue is created without showing and requiring the custom field.

If I edit an issue created like this, then the field is required as expected.

However, if I try to create with the Summary blank and one of the Component selected, then custom field appears and is required. 

I am not using an Initialiser Function or "new condition", and have tried with the Use Validator Plugin enabled and disabled.

While we have  experimented with Behaviors, this is the first need to get this up and running.

Thanks

import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
import com.atlassian.jira.component.ComponentAccessor
def customFieldManager = ComponentAccessor.getCustomFieldManager()

def hidefield = getFieldByName("Support Forum Post Location")
def component = getFieldById("components")
def componentV = component.getValue()


if (componentV.toString().contains("Customer Experience Process Improvement")) {
hidefield.setRequired(true)
hidefield.setHidden(false)
hidefield.setHelpText("This field is required when a Customer Experience issue is created")
}
else if (componentV.toString().contains("Customer Experience Support Community Item")) {
hidefield.setRequired(true)
hidefield.setHidden(false)
hidefield.setHelpText("This field is required when a Customer Experience issue is created")

} else {
hidefield.setHidden(true)

}

 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase

The benefits of using Jira in different departments

Jira is a great tool to use across different departments. Forget that paperwork – switch to Jira and get that tasks done smoothly. Marketing Jira allows for a complete digital transformation of you...

76 views 0 4
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you