Scriptrunner - differentiate Edit vs Field Edit from View

Robert Leachman 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

0 votes
Answer accepted
Peter-Dave Sheehan
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 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.

Suggest an answer

Log in or Sign up to answer