Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.
×Hello,
we migrated from JIRA 7 to 8.5.
Now I have errors with a behavior that work great before migration.
import com.atlassian.crowd.embedded.api.User
import com.atlassian.jira.component.pico.ComponentManager
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.MutableIssue
ComponentManager componentManager = ComponentManager.getInstance()
Object fieldID = getFieldById("Application")
MutableIssue currentIssue = componentManager.getIssueManager().getIssueObject(Long.parseLong(fieldID.value))
FormField pr_field = getFieldById("Application")
def isPR = componentManager.getUserUtil().getGroupNamesForUser(currentIssue.getReporter
User().getDisplayName()).contains("Groupe-P2B-Application_2")
if(!isPR){
pr_field.setHidden(false)
pr_field.setRequired(true)
}
help please ?
Thanks,
BR
Fayçal
And what exactly is the error?
Also what version of scriptrunner did you upgrade from and to?
Can you try adding the explicit import?
import com.onresolve.jira.groovy.user.FormField
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
i put this code in the behaviour :
import com.atlassian.crowd.embedded.api.User
import com.atlassian.jira.component.pico.ComponentManager
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.MutableIssue
import com.onresolve.jira.groovy.user.FormFieldComponentManager
componentManager = ComponentManager.getInstance()
Object fieldID = getFieldById("Application")
MutableIssue currentIssue = componentManager.getIssueManager().getIssueObject(Long.parseLong(fieldID.value))
FormField pr_field = getFieldById("Application")
def isPR = componentManager.getUserUtil().getGroupNamesForUser(currentIssue.getReporterUser().getDisplayName()).contains("Groupe-P2B-Application_2")
if(!isPR){
pr_field.setHidden(false)
pr_field.setRequired(true)
}
now i have this error :
please help ?
Thanks,
Fayçal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well you didn't import the correct class..
import com.onresolve.jira.groovy.user.FormFieldComponentManager
is not
import com.onresolve.jira.groovy.user.FormField
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I m sorry for the mistake :
import com.atlassian.crowd.embedded.api.User
import com.atlassian.jira.component.pico.ComponentManager
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.MutableIssue
import com.onresolve.jira.groovy.user.FormField
ComponentManager componentManager = ComponentManager.getInstance()
Object fieldID = getFieldById("Application")
MutableIssue currentIssue = componentManager.getIssueManager().getIssueObject(Long.parseLong(fieldID.value))
FormField pr_field = getFieldById("Application")
def isPR = componentManager.getUserUtil().getGroupNamesForUser(currentIssue.getReporterUser().getDisplayName()).contains("Groupe-P2B-Application_2")
if(!isPR){
pr_field.setHidden(false)
pr_field.setRequired(true)
}
i have also this error :
Thanks for your help
Fayçal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well I don't see anything wrong with that line of code.
I also don't find anything in the release notes that might be causing this for v6.x
Might be best to simply raise a call with Adaptavist for this to see if anything in the classes has changed that wasn't mentioned in the release notes.
Or hope for someone else to take a look and see whats wrong..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.
Register Now
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.