Hiding and setting default value of a custom field Behaviour

 

Aim: Use a Behaviour to set a default value for a custom field on the Create Screen, but hide it from all roles bar Administrator until a specific point in the workflow. The field needs to be populated at Create (with dummy placeholder text) otherwise the field won't exist on the issue for later population/edit via REST. 

If a non-admin user creates the issue the field doesn't appear (correct), but when an admin user later views the issue the field isn't shown. I definitely have the Administrator role, but the behaviour logs suggest otherwise...even specifying my username in the except condition does not work.

Any assistance would be much appreciated. Thanks

Log :

2017-06-13 11:58:40,552 http-nio-8070-exec-13 DEBUG tdartford 718x11120x1 15gmqqg 10.231.17.20 /secure/AjaxIssueEditAction!default.jspa [c.o.jira.groovy.Behaviour] action must be: 21
2017-06-13 11:58:40,553 http-nio-8070-exec-13 DEBUG tdartford 718x11120x1 15gmqqg 10.231.17.20 /secure/AjaxIssueEditAction!default.jspa [c.o.jira.groovy.Behaviour] must be in role: 10002
2017-06-13 11:58:40,553 http-nio-8070-exec-13 DEBUG tdartford 718x11120x1 15gmqqg 10.231.17.20 /secure/AjaxIssueEditAction!default.jspa [c.o.jira.groovy.Behaviour] user tdartford(tdartford) must be in role Administrators

Behav.png

 

 

1 answer

This widget could not be displayed.

Hola Carlos David

The fact that you have administration permissions does not mean that you are in the group "Administrators". Your group might have administration permissions but that doesn't mean that you are in THAT group. I would advice you to take a look at which groups you are part of, maybe modify the script so that only the "developers" see it, and see if that works.

Let me know if that doesn't help.

Cheers.

Daniel Yelamos 

Hi Daniel, thanks for getting back to me.

I've simplified the conditions, using a specific user condition, in an attempt to sort this problem out. 

1. Creator is tcar (works)

Create screen: Field shown, autopopuated with the default value.

View screen: displayed for tcar, hidden for other users

2. Creator is another user

Create screen: Field not shown, log output shows that the field is populated behind the scenes however with the default value.

View Screen: Hidden for other user **and for tcar** despite the except condition shown below.

 

Any ideas?

Thanks!

 

 

behav21.png

 

 

Hey Carlos David.

I want to demo this and see if I get the same behaviour as you do. Can you give me your scriptrunner and jira versions please?

Cheers

Dyelamos

Jira Core 7.3.1

Script Runner 5.0.4

 

Thanks

 

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Aug 22, 2018 in Marketplace Apps

How a Marketplace app tech team is achieving gender diversity

Hello! My name is Genevieve Blanch, and I'm the Marketing Manager at RefinedWiki, creators of apps to give teams the tools to customize Atlassian platforms. Currently, 44% of the tech team at Re...

510 views 3 18
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