Is there a way to get the Behaviour Script to execute while doing inline edits on the View Issue page?

Hi, I added a Behavior Script that sets a custom field (CF1) to a certain value based on the selected value of another custom field (CF2). All is working as expected on the Create Issue and Edit Issue pages, BUT when I simply edit the CF1 field while on the View Issue page, it does NOT update the CF2 field as expected. There aren't any errors or debug entries in the log (that I see). It appears as though the Behaviour Script isn't getting executed at all.

Is this a known limitation? ...a bug? ...or simply user error (totally possible smile)? I didn't see anything about it in the documenation (https://scriptrunner.adaptavist.com/latest/jira/behaviours-overview.html#_limitations).

We're on JIRA 6.0.8 with Behaviour Plugin v0.5.10. Any help on this would be greatly appreciated... thanks!

 

3 answers

I've never used Behaviours, so can't say; however, just to throw out some ideas in case this is a limitation you won't be able to bypass, options are:

1) Disable inline editing at the site config level. (Edit: never mind, that requires JIRA 6.2).

2) Remove the edit permission from your project and provide custom 'edit' workflow actions to replace it, using conditions to limit permissions to the same role/groups you would have allowed 'edit'.  This should disallow inline editing at the project level.

3) Use a script listener instead of Behaviours to set the second custom field if you see the first custom field get edited.  That will cover any edit that emits an event, which should apply to inline edits as well as regular Edit Issue, etc.  Unfortunately, it may also break up the history into two different updates, instead of one, assuming Behaviours does it in one go (which I'm guessing it does, and could be related to why an inline edit doesn't work).

Hi Sherri,

Behaviours only works on the create and edit screen of issues and by limitation does not work when a field is in-line edited.

One workaround for this issue is to apply some JavaScript to the field to disable in-line editing for the field on a project level. I have attached an example of some JavaScript that can be used to do disable in-line editing on fields.

This code can be placed in the description for the field on the field configuration scheme used by the project in order to make it fire.

<script type="text/javascript">
AJS.$(document).ready(function() {
setInterval(function() {
  // Disable the field based on its id. customfield_10802 - references my DemoTextField in this example
  AJS.$('#customfield_10802-val').removeAttr('class');
  AJS.$('#customfield_10802-val').children('.icon').remove();
  AJS.$('#customfield_10802-val').children('.aui-icon-small').remove();
  AJS.$('#customfield_10802-val').removeAttr( "title" )
}, 200);
 });
</script>

I hope this helps

Kristian

0 votes

More recent versions disable inline edit for those fields where a behaviour is applied. Inline edit can't sensibly be used when you're trying to validate multiple fields in conjunction with each other, so it just disables it.

Suggest an answer

Log in or Join to answer
Community showcase
Teodora [Botron]
Published Feb 15, 2018 in Marketplace Apps

Jira Inferno: The Nine Circles of Jira Administration Hell

If you spend enough time as a Jira admin - whether you are managing a single, mid-sized instance, a large enterprise one or juggling multiple instances at once - you will eventually find yourself in ...

1,121 views 6 19
Read article

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot