Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

ScriptRunner Behaviours on Cloud - odd issue with custom field

Esther Strom
Community Champion
February 20, 2023

I'm attempting to duplicate the functionality shown in this video. I have two single-choice select fields, and I want to hide one based on the value of the other. 

2023-02-20 12_41_11-Custom fields - Jira.png

Automatable is customfield_10578, and Automation Status is customfield_10577.

When I go to choose a field, however, Automatable is not an option in the dropdown:

2023-02-20 12_40_54-Behaviours - Jira.png

Which is fine; it's Automation Status that I'm trying to show/hide. So I select that, and write this script:

 

// Insert the Jira UI modifications API script for the behaviour.

const autoStatus = getFieldById("customfield_10577");

const autoYes = getFieldById("customfield_10578");

logger.info("Value : " + autoYes.getValue().name);

if(autoYes.getValue().name !== "Yes") {

    autoStatus.setVisible(false);

    logger.info("false");

}

else {

    autoStatus.setVisible(true);

    logger.info("true");

}

But on the line defining the autoYes constant, I get the following error. I don't understand why this field isn't available to the script in any way; it's the same field type as the other one being used and that one is visible in the dropdown and doesn't show an error.
The script is not running; I'm not even getting the logger results.
Any ideas?

 

No overload matches this call.
Overload 1 of 2, '(fieldId: "customfield_10577"): AffectedField', gave the following error.
Argument of type '"customfield_10578"' is not assignable to parameter of type '"customfield_10577"'.
Overload 2 of 2, '(fieldId: "customfield_10071" | "customfield_10505" | "customfield_10507" | "customfield_10064" | "customfield_10069" | "labels" | "assignee" | "customfield_10051" | "customfield_10052" | ... 165 more ... | "customfield_10517"): Field', gave the following error.
Argument of type '"customfield_10578"' is not assignable to parameter of type '"customfield_10071" | "customfield_10505" | "customfield_10507" | "customfield_10064" | "customfield_10069" | "labels" | "assignee" | "customfield_10051" | "customfield_10052" | ... 165 more ... | "customfield_10517"'.(2769)

1 answer

0 votes
Bobby Bailey
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 27, 2023

Hi @Esther Strom 

I am Bobby (from the video!) I have had a look at your issue and I can't seem to replicate the issue. Would it be possible for you to raise a bug ticket here at our portal here: https://productsupport.adaptavist.com/servicedesk/customer/portal/23, so that one of our team can help you solve this?

Kind regards, 

Bobby

Esther Strom
Community Champion
February 28, 2023

@Bobby Bailey thanks for the response. I did open a ticket last week. It's very strange; with that particular behavior, I made no changes to it overnight but when I went back the next day the errors were gone and it was working. However, every time I try to create new behaviors, I either get those same errors or they just don't run (nothing in the logs).

Either the product is still quite buggy, the documentation is very incomplete, or something went wrong during the installation on our instance. 

Suggest an answer

Log in or Sign up to answer