Hiding and setting default value of a custom field Behaviour

Carlos David June 13, 2017

 

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

0 votes
Daniel Yelamos [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 20, 2017

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 

Carlos David June 20, 2017

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

 

 

Daniel Yelamos [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 21, 2017

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

Carlos David June 21, 2017

Jira Core 7.3.1

Script Runner 5.0.4

 

Thanks

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events