Setting fields hidden/shown with Behaviours Plugin, not functioning?

I'm trying to implement this:

https://jamieechlin.atlassian.net/wiki/display/JBHV/Miscellaneous+Behaviours+Examples#MiscellaneousBehavioursExamples-Showorhidefields

in the exact scenario. We have users who abuse Blocker, so I wanted to create a justification window with a custom note if a user selects blocker.

I configued the Custom Field...and I set up the Behavior on Priority to either show or hide this field if blocker is selected, but it doesn't seem to do that...this is something I need for the Create Issue Screen. Not sure what I'm doing wrong?

10 answers

0 vote

Did you apply the behaviour to a project? Can you paste relevant screenshots?

behaviour settings

applied to project:

0 vote

It should be a script not a method. Looks like you are just defining a method but nothing will call that.

oops. i missed that part of the instructions. So I can add that method to the existing ScriptSample.groovy file, yes?

0 vote

I think so... but I would just paste it in to the box where you currently have it, but without the public blah() {...}

One other question...does the getFormValue method always return an integer? So, 1 = Blocker, 2 = Critical, etc. or do I have to modify it to match the actual String values of my priorities?

0 vote

getFormValue returns a string, it looks like an integer though. getValue() should return an actual priority object which you can call .getName() on.

Hi Jamie,

I using behavior to hide comments. It was working fine few days back now it is not working. in fact it is not working anything now.

 

Here is xml for your reference:-

<config use-validator-plugin="false" name="Hide Comments " description="WMS_WF" guideWorkflow="WMS_WF_Jan_6_2015">
<field id="comment" required="null" readonly="null" hidden="true">
<when action="541"/>
<when action="61"/>
</field>
</config>

I enabled logging and found following error:-

2015-01-06 09:51:29,744 http-bio-9091-exec-67 ERROR RXS0VH3 591x29122x1 1fuav3m 10.252.104.57 /rest/com.onresolve.jira.plugin.Behaviours/1.0/behaviours/validators.json [common.error.jersey.ThrowableExceptionMapper] Uncaught exception thrown by REST service
java.lang.NullPointerException  at org.codehaus.groovy.runtime.callsite.GetEffectivePojoPropertySite.acceptGetProperty(GetEffectivePojoPropertySite.java:51) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:227)
  at com.onresolve.jira.behaviours.BehaviourManagerImpl.getBehaviour(BehaviourManagerImpl.groovy:260)
  at com.onresolve.jira.behaviours.restservice.BehavioursEndpoint.getValidatorsFromIssueId(BehavioursEndpoint.groovy:44)
  at sun.reflect.GeneratedMethodAccessor817.invoke(Unknown Source) <+1>
  at java.lang.reflect.Method.invoke(Unknown Source) <+19> (DispatchProviderHelper.java:234) (DispatchProviderHelper.java:100) 

 

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Tuesday in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

407 views 1 18
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you