Behaviours error after migration JIRA server 8.5

BYA January 13, 2021

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

1 answer

0 votes
Dirk Ronsmans
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 13, 2021

And what exactly is the error?

Also what version of scriptrunner did you upgrade from and to?

BYA January 13, 2021

Hello, 

this a screen shot of this error :

Sans titre.png

ScriptRunner from V 5.6.12  to V 6.16.0.

Thanks for your help. 

BR

Dirk Ronsmans
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 13, 2021

Can you try adding the explicit import?

import com.onresolve.jira.groovy.user.FormField
BYA January 13, 2021

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 : 

Sans titre.pngplease help ? 

Thanks,

Fayçal

Dirk Ronsmans
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 13, 2021

Well you didn't import the correct class..

 

import com.onresolve.jira.groovy.user.FormFieldComponentManager 

is not 

import com.onresolve.jira.groovy.user.FormField
BYA January 13, 2021

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 : 

 

Sans titre.pngThanks for your help

Fayçal 

Dirk Ronsmans
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 13, 2021

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..

BYA January 13, 2021

I hope so too.
Thank you for taking the time to help me

Suggest an answer

Log in or Sign up to answer