Structure not syncing when live updating

Diana
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 3, 2022

I have a Behavior in scriptrunner where if a custom field was unchecked, then another custom field gets cleared.

But when I uncheck the custom field on the Structure, it still shows the other custom field as filled out and not cleared. Only when I go on the issue view and make the edits, it works properly, but it still doesn't reflect in structure unless I hit refresh.

How can I get Structure to sync properly so that I can update manually any issue and it runs the behaviors I had set?

2 answers

1 accepted

1 vote
Answer accepted
David Niro
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
February 3, 2022

Hello @Diana Gorv ,

David from ALM Works here.

The scenario you describe sound similar to the one discussed in this thread.  It contains some steps that may help in addition to the recap below.

To recap:

Structure relies on Jira's EventManager updates to refresh data.
Please check if the updates you expect to see in Structure are being displayed in the Issue's History Tab.
You should be able to see a "made changes" entry if you open the Issue and look at the History tab under the Activity section of the page.

If there's no update on the Issue History, our suggestion is to change the script to use either one of these options:

  • initiate issue event manually using IssueEventManager
  • use IssueManager.updateIssue() with corresponding event dispatch option to update the field.

If you do see the events in the issue history, it may be best to work directly with our support team. You can initiate a ticket by emailing support@almworks.com or through our portal support.almworks.com.

Best,
David

Diana
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 7, 2022

Hi @David Niro thank you for the quick response back.

I checked the issue's History Tab and I was able to see my activity captured the changes perfectly. The script works fine on the issue view level, and when I edit on the issue, it reflects on the Structure after a few seconds.

But only when I try manually editing on the Structure, the script doesn't seem to run. And when I check the issue's history tab after a manual edit on Structure, I saw that the custom field I unchecked was captured, but it didn't clear the other custom field and the history tab showed no activity.

I did research about a Structure Dark Feature ability that can force a structure to reindex whenever there's a change, but I rather not go that route if it means a possibility of messing up our entire instance. For now, it's not so much a major hinderance on our process, but rather a minor annoyance. We've been doing a workaround by either bulk editing or opening a new window tab and edit on the issue view. 

But it would be nice if there was a possible fix. I'll send an email ticket.

Like Dave Rosenlund likes this
David Niro
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
February 7, 2022

Hello @Diana Gorv

You are very welcome!  Thank you for the additional details!!!

To recap:

When updating your field on the Jira issue details view:

  • The script runs and clears the second field
  • You see both events (update of first field and clearing of second field) in the history
  • You see both fields update in Structure

When updating your field from Structure:

  • You see the first field is updated in Structure
  • The second field does not get updated in Structure
  • In the history, you do not see the first field was updated
  • the second field remains populated

I just want to be 100% sure I have the scenario correct.   If so, you are on the right path with the dark feature for indexing.  The second of the two options is less heavy though I still understand the hesitancy.

Best,
David

Like Dave Rosenlund likes this
Diana
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, 2022

Yes, everything was correct except when updating my field from Structure:

  • In the history, I do see the first field was updated
  • but the second field remains populated, and no history was updated
Like Dave Rosenlund likes this
David Niro
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
February 9, 2022

@Diana Gorv 

Thank you for clarifying that for me!  If the event is being recorded in the issue history when changing the field in Structure, I would expect the corresponding action to take place.

In other words, I think something else is going on here.

Would you mind creating a support ticket via email support@almworks.com or through our customer portal support.almworks.com?

We will want to review the logs and discuss the script being used.

Best,
David

Like Dave Rosenlund likes this
Diana
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 10, 2022

Hi @David Niro 

I emailed the support team a ticket. I reference back to this question for them to review. But I'll share the code I used here for future reference:

Code below used in Behaviors for field Custom A server-side script. No conditions added. Switches set to Optional, Writable, and Shown:

import com.onresolve.jira.groovy.user.FormField

 

def customA = getFieldByName(“Custom Field A”)

def customB = getFieldbyName(“Custom Field B”)

def customAValue = customA.getValue()

 

if (customA.getValue() == “Yes”){

   customB.setHidden(false)

   customB.setRequired(false)

 

}else {

   customB.setHidden(true)

   customB.setRequired(false)

   customB.setFormValue(null)

}

 

Thanks!

Like Dave Rosenlund likes this
David Niro
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
February 10, 2022

Hello @Diana Gorv ,

Thank you for creating the support ticket and for the details on the script you are using.

I was looking into next steps and researching Behaviours a bit more and found the following information on the Adaptavist knowledge base:

Screens

Behaviours function on the Create Issue, Update/Edit Issue, Assign Issue, and Workflow Transition screens.

On the View Issue screen, trying to edit a field with a behaviour will launch the edit issue screen, instead of the normal inline editor.

Behaviours will not work on the Move Issue screen. They also do not work for any bulk issue operations or any issue edits that bypass the UI such as the REST API and other ScriptRunner scripts.

It seems that Behaviours are tied to the UI and do not work in any areas that bypass that UI (Structure being one of these).
There are a couple of options that may be worth looking into. 

The first would be to use a Listener instead of Behaviours.
The second would be to require this change be made on the issue detail screen.  If you want to see Field A and Field B in the structure, you can make them uneditable by adding them as a Formula Column rather than Field Column.
You would just add a formula column and then type the name of the field.  It will show the value, but will not allow editing.
We also have dev task in our backlog related to this topic.  If there are any changes / a better solution, I will be sure to let you know.
Please let me know if this helps.

Best Regards,
David
Like Dave Rosenlund likes this
Diana
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 14, 2022

@Hi @David Niro 

This makes a lot of sense! I was wondering if Listeners was the solution and not Behaviors. I will give this a try. I truly appreciate your help!

Like # people like this
David Niro
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
February 14, 2022

@Diana Gorv you are very welcome!!

Like Dave Rosenlund likes this
0 votes
Dave Rosenlund
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 3, 2022

Hi, @Diana Gorv. Welcome to the community! That sounds strange, indeed.

I'll share your post with some people I know who are much smarter than me about such things.  Stay tuned.

-dave 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events