Forums

Articles
Create
cancel
Showing results for
Search instead for

Argument of type '"customfield_10687"' is not assignable to parameter of type '"customfield_10689" |

Ramez Kaupak August 28, 2023

I am trying to edit a custom filed. but i can not do anything. it gives an error.  i am using script runner for behaviours.

i have no problem editing other custom fields and even assigning aliases to them. but this field (cascading select) does not want to cooperate. i just need to set it to visible and invisible. please help.

Argument of type '"customfield_10687"' is not assignable to parameter of type '"customfield_10689" | "customfield_10630" | "customfield_10510" | "customfield_10621" | "customfield_10500" | "customfield_10622" | "customfield_10624" | "customfield_10625" | ... 299 more ... | "priority"'. (2345)

const question = getFieldById ( "customfield_10689" ) //Is the issue related to specific components or process plans?
const title = getFieldById ( "customfield_10688" ) // title
const work_number_serial = getFieldById ( "customfield_10690" ) //work_order_number
//customfield_10691 how much time
//customfield_10687 process plan selection

work_number_serial . setVisible ( false )
//getFieldById("customfield_10691").setVisible(false) //how much time
getFieldById ( "customfield_10687" ). setVisible ( false ) // process plan selection
if ( getChangeField (). getName () == question . getName ()) {
if ( question . getValue (). value == "Yes" ){
work_number_serial . setVisible ( true )
title . setValue ( "is related" )
}
else if ( question . getValue (). value == "No" ) {
title . setValue ( "not related" )
}
else {
title . setValue ( "did not recognize an asnwer" )
}
}
else {
work_number_serial . setValue ( "did not recognize the field" )
image.png

Hello @Ramez Kaupak

This is a bit of a guess based on my experience as a code developer, though I have not worked much with Java.

My guess is that the problem is you have not assigned the field object for customfield_10687 to a variable before trying to change its setVisible property.

See how you have declarations at (1) for the field objects for other custom fields? I believe you need to do the same for customfield_10687. Then at (3) you need to use setVisible the same way you do at (2), using the appropriate variable that you created for it in the declarations at (1).

AUG Leaders

Atlassian Community Events