ScriptRunner - Triggering one behavior scripts within a separate behavior script?

Michael
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.
May 12, 2023

Hello,

Is there a way to trigger a particular behavior script (Script A) within a separate behavior script? (Script B)

1 answer

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 13, 2023

I'm afraid it is not possible - Behaviours are injected into screens, and the browsers rendering them have no way to support this.

Michael
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.
May 15, 2023

Thanks @Nic Brough -Adaptavist-, I knew it was a long shot but I thought I should ask.

The reason I ask, is because we have 3 separate single select custom fields, 2 of which we currently have scripts within, and the 3rd we want a script to check the values of both previous fields in order to change values within that field.

For example:
"Brand" customfield (Brand1, Brand2, Brand3)

  •  The "Brand" field we have a script which changes the available values within the "Team" single select based on the brand value selected.

"Request Type" customfield (New, Update Existing, Perm Change)

  • The "App Request" field has a script which shows / hides fields based on the request type. 

"Team" customfield (Team1, Team2, Team3, Team 4)

Goal:
We want to have a script within the "Team" field which looks at the values within both the "Client" and "Request Type" field so that:

1) If the "Request Type" is "New" -> This script "overwrites" the previous Client script and opens up all values within the "Team" customfield.

2) If the "Request Type" is either "Update Existing", "Perm Change", the "Team" script would do nothing and leave the values alone. (IE: The field values would still be changed by the "Brand" field script.

 

Is there anyway this could happen?

Michael
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.
May 15, 2023

Also @Nic Brough -Adaptavist-

I've noticed that (at least in my environment) when a user loads a screen a behavior is within, it seems to take a "second" for the behavior to run; basically making it look like there are a bunch of options before "Jira" takes all those options away and replaces them with what has been scripted within the needed behaviors.

I've tried adding a ".setHidden" to all the needed fields within the "Initializer" scripting section, but even then it still seems like the behaviors takes the same amount of time to "load".

Is there some type of option which allows us to run the behaviors before the form renders to the user?

Thanks,

Mike

Like Srikanth Ganipisetty likes this
Srikanth Ganipisetty September 2, 2023

@Michael / @Nic Brough -Adaptavist-  - Any solutions for this issue? We are seeing the similar issue where the behaviors are running slow and is waiting for the form to load the fields first. This is understanding to us as the Jira admins, but we see many users were complaining about this use case? They were trying to add some info. into a field which is 1) setting to required in about 5 - 6 seconds and 2) is changing the remaining fields as per the logic we set.

This is happening once they set some value and clicks on the "Create" button and but noticed there were some fields changed in this time-gap.

Thanks,

Srikanth Ganipisetty

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 8, 2023

It's the same answer - Beahviours can't run anything before the screen renders - it's working from the data in the screen.

Suggest an answer

Log in or Sign up to answer