Forums

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

customField.setAllowInlineEdit(false) is not working in Behaviour

Dan27
Contributor
June 29, 2020

Hello,

 

I want to 'read only' field fixVersion in Jira.

In edit screen in is working okay, But in view screen it is not read only and users can edit it.

I tried to use this intialiser without success:

def customField = getFieldByName("Fix Version/s")
customField.setAllowInlineEdit(false)

 

What am I doing wrong?

Thank you,

Daniel

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
PD Sheehan
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 Champions.
November 29, 2021

The issue you're working with is just an object in memory. You have to use either the issueManger or the issueService to persist the change to the database

I see you've instantiated the issueService and issueInputParameters but haven't used them. 

Instead of using issue.setComponent, try to use the issueInputParameters:

import com.atlassian.jira.event.type.EventDispatchOption
/* your existing code */
if (ComponentValue) {

log.debug(ComponentValue)
issueInputParameters.setComponentsIds(ComponentValue.id)
def updateValidationResult = issueService.validateUpdate(user, issue.id, issueInputParameters
if(updateValidationResult.isValid()){
issueServerice.update(user, updateValidationResult, EnventDispacthOption.DO_NOT_DISPATCH, false)
}

}

If you want event and email dispatched, you can omit those last 2 parameters or set them accordingly.

TAGS
AUG Leaders

Atlassian Community Events