Forums

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

Scriptrunner Behaviour Error Displayed in Wrong Place

Dorian Workman
Contributor
April 30, 2020

Please see attached screenshots.  For some reason the error message generated by the Behaviour on the Fund(s) field is not displayed with that field, but at the bottom of the Edit dialog.  Any suggestions how to get it to display right below the Fund(s) field please? 

Also, for some reasons a leading colon (:) is being inserted at the beginning of the error message, any ideas why?

@PD Sheehan I see you've solved a couple of similar behaviours questions before, could you possibly help me with this one please?

Thanks!

 

Behavior.png

Error Message.png

3 answers

1 accepted

0 votes
Answer accepted
PD Sheehan
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.
April 30, 2020

I would suggest also examining the api calls from your browser development panel.

Look at the response from GET: validators.json

Then look at the payload and response from POST: runvalidator.json

You might be able to find some clues there.

Dorian Workman
Contributor
April 30, 2020

Thanks @PD Sheehan, please see screenshots below.  I've never looked at the dev console before so please forgive me if I'm asking basic questions.  The first screenshot appears to show the validators that were loaded for the field when the edit screen first loaded.  The second I think shows what happened when I entered the bad value in the field.  Does this offer any clues? If there some sort of a conflict between the Behaviour response and the I18N response (whatever that is)?

Load.png

Value Entered.png

PD Sheehan
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.
April 30, 2020

I see nothing abnormal there. 

More importantly, it's clear that the helptext doesn't include the (:).

The only other thing I can think of is to check your "configure field" option on the screen and make sure you have ShowFields = All. I've seen behavior misbehaving (ha!) when custom field selections have been made.
If that's the case and this fix your issue, I'd recommend you report it to Adaptavist Support.

Like # people like this
Dorian Workman
Contributor
April 30, 2020

OMG that was it!  Eureka!  You're a genius @PD Sheehan!

Do you know if all users would need to set their "configure field" option like this individually, or this is a one-time admin setting?

 

Fixed.png

PD Sheehan
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.
April 30, 2020

Unfortunately, that's every user.

It used to be that those validation errors would go completely unnoticed and behaviour was unable to prevent submitting the form if errors were present on hidden fields.

So perhaps they've made some inroads into fixing that, but that causes the message to not be placed against the correct field.

1 vote
Leonard Chew
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.
April 30, 2020

Your field has got brackets in its name, which are special characters. Without having tested it, I'd suggest to get the field by ID instead of getting it by name, try:

def fundsField = getFieldById("customfield_nnnn")

replace nnnn with the id of your custom field

PD Sheehan
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.
April 30, 2020

Yeah, I'd try this first.

This is not a situation I've seen directly. My guess would be that perhaps you have 2 fields with the same name and behavior is picking the wrong one.

Though before, in the situation where the field that the error is set on is visible on the screen, my experience was that the error was simply not displayed. Perhaps things have changed with newer versions of scriptrunner.

The other thing I'd say is that I don't think you'll be able to pick up "Please select..." in fundsField.value. I expect the value will be null if you haven't selected anything.

PD Sheehan
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.
April 30, 2020

Nevermind that last point... I see you have an actual option called Please Select.

Do you perhaps have another behavior configuration that tried to do the same thing?

I'm wondering where the ":" colon is coming from in

:Remove the "Please Select.." option 
0 votes
Dorian Workman
Contributor
April 30, 2020

Thank you @Leonard Chew and @PD Sheehan for your suggestions, but unfortunately no luck.

I tried getFieldByID, exact same result.  I also tried renaming the field to remove the parenthesis, also no luck.

I don't have any other Behavious on that field either.

As you noted @PD Sheehan, 'Please select..." is a defined option in that multi-select list (it's the default option, so that the field is always displayed on the View screen).

Any other thoughts?

Thanks.

Suggest an answer

Log in or Sign up to answer