Forums

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

Conditions on ScriptRunner behavior are not applied

Sander Spoelstra
Contributor
March 4, 2023

Hi,

I'm working a lot with behaviors and one of the more simple behaviors I have configured now seems to not apply the configured validator / condition. I'm rather stumped by this as it isn't a complex script nor is the behavior some oddity.

 

What I'm trying to achieve is:

  • Make two fields mandatory based off the value of a third field
  • Only have this applied to the transition that has a screen with those fields 

The behavior I've configured for this is:

behavior.png

In the workflow itself, only the field 'Release Notes Needed' is set as mandatory field. The others are not configured in any validator:

transition validator.png

There is one other behavior for this field, but this only sets the field to read-only (except for some groups):
read-only behavior.png

 

 

Unfortunately, this behavior now also apply when I for example 'edit' the issue:edit issue.png

 

Long story short: am I doing something wrong? Is this a bug in ScriptRunner? Am I missing some crucial configuration?

1 answer

1 vote
Rik de Valk
Community Champion
March 4, 2023

Hi @Sander Spoelstra , I would suggest using a scripted validatior instead of a Behavior. You can read more about these here: https://docs.adaptavist.com/sr4js/latest/features/workflows/workflow-functions-tutorial/validators-tutorial 

Sander Spoelstra
Contributor
March 5, 2023

Thanks! I know this is possible and have build other scripts before. This does not settle my curiosity though as to why the above doesn´t work? If I limit the behavior to a single workflow action, then it shouldn't apply to edit, or am I missing something about how behaviors work?

 

Also, a fullblown script seems a bit overkill when a behavior could potentially do the same.

Rob B
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 8, 2024

@Sander Spoelstra  - Did you resolve this? Im having the same issue

SKAdmin
Contributor
May 21, 2024

Also running into this problem, seems like a bug of some sort, as my field is showing a required for all users regardless of the condition. 

Suggest an answer

Log in or Sign up to answer