Hi,
i need a groovy script that sets all fields on a mask readonly, so I can use it for different projects and dont need to set a ReadOnly Rule for every fields manually.
I have the following code. When the two conditions are true, a specific field is set readonly.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.security.roles.ProjectRoleManager
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def exampleField = getFieldById(getFieldChanged())
if (currentUser == underlyingIssue.reporterUser && getDestinationStepName() != "Draft")
{ exampleField.setReadOnly(true) }
else
{ exampleField.setReadOnly(false) }
And I have the method that gives me all the field id's
getFieldScreen().getTab(0).fieldScreenLayoutItems*.id
But I'm not able to write the code (beginner), that let the script iterate through all the ids and set them Readonly.
I'm sure that's a simple one.