Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

I deleted the content that I applied to Behaviour, but it still works as it is

이나은 September 12, 2023

I set the attachments field to ReadOnly when running a particular transition.

def attachment = getFieldById("attachment")
if(getAction()){
  if(getAction().getId()==171){
        attachment.setReadOnly(true)
   }
}
However, this setting is no longer needed, so even though I deleted it, it becomes ReadOnly.
Set to setReadOnly(false) also becomes ReadOnly.
Even if you delete the mapping, delete the Behavior, delete the cache, restart the server, it does not change. It continues to work as the first script.
How can I change it so it doesn't become ReadOnly again?

3 answers

1 accepted

0 votes
Answer accepted
이나은 September 17, 2023

I found a reason.
In the workflow, the properties in that status were set to 'jira.permission.attach.denied'.

0 votes
Ram Kumar Aravindakshan _Adaptavist_
Community Champion
September 13, 2023

Hi @이나은

I have a few questions. Firstly, what version of ScriptRunner and Jira are you currently using?

Second, have you double-checked if the Attachment field itself has been set to read-only in the Field configuration schema, as shown in the screenshot below:-

image1.png

Also, could you please include a fullscreen screenshot of your Behaviour configuration so I can get a better understanding and try to provide a better solution?

Thank you and Kind regards,
Ram 

이나은 September 13, 2023

Image upload is not possible due to company security policy. Please excuse me.

I also checked the field configuration, and it is set exactly like the image you uploaded.
Also, the Attachment field is editable when in a different state, but it's changing to ReadOnly when I run a specific transition (the 171 transition specified in the script).

I already deleted the Behaviour that I set up at the beginning.
However, to explain Bahaviour configuration at the time, it is as follows.

After creating a Name, Description.
Set up the following scripts in Initialiser.

 

def attachment = getFieldById("attachment")
if(getAction()){
  if(getAction().getId()==171){
        attachment.setReadOnly(true)
   }
}
I saved it without any other settings.
Ram Kumar Aravindakshan _Adaptavist_
Community Champion
September 14, 2023

Hi @이나은

Could you please clarify what version of Jira and ScriptRunner are you currently using?

Thank you and Kind regards,

Ram

이나은 September 14, 2023

Atlassian Jira Project Management Software v8.20.12
Adaptavist ScriptRunner for JIRA 6.58.0

Thank you.

0 votes
Radek Dostál
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.
September 13, 2023

Open web dev tools and press the transition so you get the transition screen popup.

Your browser should send a POST similar to /rest/scriptrunner/behaviours/latest/validators.json?issueId=5367087&actionId=41&ignoreInitialiser=false

 

Can you paste the response? It should contain whatever behaviours are affecting that screen, my aim is to find out whether there are any behaviours at all (in which case, we would know the behaviour ids), or if there are none at all - in which case, the readonly is not caused by behaviours.

 

I might be wrong here, but I don't think behaviours care about browser cache, nor are they really cached on server per se. Any change to behaviours should come into effect immediately. I would imagine the browser just calls for behaviours for the action, and if there are any, it will then get the response and use it to apply some javascript to the page, but that just an assumption I never had the need to look into it.

이나은 September 13, 2023

Response:

Cache-Control:
no-cache, no-store, no-transform
Content-Length:
2762
Content-Security-Policy:
sandbox
Content-Type:
application/json;charset=UTF-8
Date:
Thu, 14 Sep 2023 01:16:25 GMT
Referrer-Policy:
strict-origin-when-cross-origin
Server:
Strict-Transport-Security:
max-age=31536000

X-Arequestid:
616x28925x1
X-Asessionid:
boczw7
X-Ausername:
jirauserid
X-Content-Type-Options:
nosniff
X-Frame-Options:
SAMEORIGIN
X-Powered-By:
ASP.NET
X-Seraph-Loginreason:
OK
X-Xss-Protection:
1; mode=block

 

If the ReadOnly is not caused by behaviours, then what are the possibilities?

The attachment field changes to ReadOnly when the transition is executed, and it is editable when the issue is in a different state.
There is nothing set for the Attachment field in the post function or other operations that run during transition.

Radek Dostál
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.
September 14, 2023

Those are headers, not the actual response data.

이나은 September 14, 2023

{
...,
"attachment": {
"readonly": false,
"fieldType": "com.atlassian.jira.issue.fields.AttachmentSystemField",
"displayName": "첨부 파일"
},
"issueTypeId": {
"fieldOptions": [
...
],
"fieldType": "com.atlassian.jira.issue.fields.IssueTypeSystemField",
"displayName": "이슈 유형"
}
}

 

Attachment's readonly is false.
(Other items were omitted due to in-house security rules.)

It's still turning into ReadOnly, but I don't know why.

Suggest an answer

Log in or Sign up to answer