Hi,
what should we change in the bolded code, to make it work with JIRA 7. We migrate and our old scripts do not work!
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.customfields.manager.OptionsManager
def componentManager = ComponentManager.getInstance()
def customFieldManager = ComponentManager.getInstance().getCustomFieldManager()
def cf1 = customFieldManager.getCustomFieldObjectByName("Department responsible")
def groupManager = ComponentAccessor.getGroupManager()
def currentSecurityLevelId = issue.getSecurityLevel().id
String[] departments = ['department-auto','department-bim','department-korzeniewski','department-ntc','department-pbs','department-siuda','department-wasilewski','department-wolodko','department-zaremba','department-wasilewski-pmo','department-wasilewski-adm','department-pbs-abap','department-pbs-logistic','department-adm','department-poznan','department-hr']
int[] securityIds = [10300,10301,10302,10303,10304,10305,10308, 10306,10307,10400,10401,10402,10403,10500,10501,10502]
def departmentResponsible = cf1.getValue(issue).name
for (def i =0; i<departments.length; i++){
if (groupManager.isUserInGroup(departmentResponsible, departments[i])){
if(currentSecurityLevelId == securityIds[i]){
return
}
}
}
for (def i =0; i<departments.length; i++){
if (groupManager.isUserInGroup(departmentResponsible, departments[i])){
issue.setSecurityLevelId(securityIds[i])
return
}
}
What is the error?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You should provide info about the problem with your script, otherwise it is impossible to help you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The problem is: when I moved jira to version 7 and put new link to groovy script (in a workflow transition, a postfunction), I get a message "Don't see or cant read the file".
So, I don't know if it is a problem with old script or the other problem.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That message means you have told Jira to read a script on the disk. The file with the script in it is either not where you've told it it is, or it is not readable by the user Jira is running as.
It's nothing to do with the content of the script, you need to fix the installation of the script file.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What does it mean "it is not readable by the user Jira is running as"? How is it possible
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Again. Your script is in a file. Jira cannot read that file from the disk. Check the permissions and that the file exists.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.