The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

Scriptrunner - differentiate Edit vs Field Edit from View

Robert Leachman
Contributor
May 3, 2023

My issue type has many fields on few tabs, including a custom field date type on tab 2.

When the user edits the date we need a behavior to check and set another custom field. This works fine.

From the View screen if they try to directly edit the date, the Edit screen pops since that is how behaviors work. Executing `switchTab(2)`takes them to the correct tab and the field has focus. Beautiful.

What I need is a way to differentiate when they do this, versus simply clicking the Edit button to open the edit screen to change another field. When that happens right now the behavior fires and tab 2 is displayed.

How can we test the special case where the user want to edit a field from a behavior versus simply edit the issue?

I hope this is clear, thanks!

 

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

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 Champions.
May 3, 2023

I do not believe that it is possible from a behaviour initialiser script to detect if the screen was opened by clicking the edit button or attempting to open an in-line edit.

I would view this as a feature request (or bug) for Adaptavist to have whatever logic automatically puts the focus on the field that the user clicked on to trigger the dialog (something in the javascript layer) to identify and automatically switch to the correct tab so that the auto-focus works in all cases (right now it only works when the field is on the first tab).

IMO, this should be built-in and you should not have to code the tab change.