Hey community,
I've written a listener that changes the value of a certain custom field.
The problem is that the field does get updated in the relevant issue but on Structure it doesn't (only if I manually update some field in that issue via Structure and then it updates the data). In addition, I've tried to add re indexing to the listener script and the logs shows everything works fine, also when I export the issues the data is updated which means the changes are actually written to the database.
In conclusion, I think the problem is in the structure "behavior".
Thanks in advance.
Hello @Yuval Maron
David from ALM Works here.
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:
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.
Please let me know if this helps. I look forward to your reply!
Best Regards,
David Niro
www.almworks.com
@David Niro
Thank you for your help!
I don't see the relevant changes in the activity history,
The second option didn't work for me, you have an example of the first one and how to use it?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Yuval,
You are very welcome!
I can share an example of how each option would look.
Option 1:
import
com.atlassian.jira.event.issue.IssueEventDispatcher
def
CUSTOM_SCRIPTRUNNER_UPDATE_EVENT = 10000 // TODO: define event type id here
IssueEventDispatcher.dispatchEvent(CUSTOM_SCRIPTRUNNER_UPDATE_EVENT, issue, null, false);
Option 2:
issue.setCustomFieldValue(customField, customFieldNewValue)
ComponentAccessor.getIssueManager().updateIssue(ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser(), (MutableIssue)currentIssue, EventDispatchOption.ISSUE_UPDATED, true);
Please let me know if this helps! I look forward to your response!!
Best Regards,
David Niro
www.almworks.com
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks, I'll continue Yuval's work on this issue :)
Is 1000 the ID of the task update event?
If not, how can I find this ID?
Best Regards,
Dorin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @dorin gez !
1000 is an example. You will need to create a custom event and then reference it. Here are the steps:
1) Add a new custom event using *Administration* *>* *System >* *Advanced > Events,* add a new event using template - *Generic Event*.
2) Take the *event type id* that can be found in the browser address bar if click the ‘Edit’ link for the new event
3) Update the scripted field - add triggering this new custom Jira event on the value calculation. The *_event_type_id_* should be taken from the previous step.
Please let me know if it helps!
Best Regards,
David Niro
www.almworks.com
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hell @David Niro !
Thank you so much for the detailed tutorial it really helped me understand your solution.
I created an event and linked it as described in your explanation and the update is still not done properly - nothing changes inside the structure..
Code:
import com.atlassian.jira.event.issue.IssueEventDispatcher
def CUSTOM_SCRIPTRUNNER_UPDATE_EVENT = 10100 // My Generic Event
IssueEventDispatcher.dispatchEvent(CUSTOM_SCRIPTRUNNER_UPDATE_EVENT, issue, null, false);
I would be happy for your help to correct my code
Thank you,
Dorin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @dorin gez ,
You are very welcome! To assist further, we would need to review the entire script.
Would you please initiate a support request with us? You can email support@almworks.com or create a directly from our portal support.almworks.com.
I look forward to continuing our conversation!
Best Regards,
David Niro
www.almworks.com
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm also having a problem with Sturcture syncing to current Issue fields. I recently updated values in the Component field on two different but related projects. I updated the Component fields in the Project Settings>Component page, so the changes would propogate across the Issues that are already tagged with the respective component values.
For both projects, if I go into the issues, the Component values are updated. But in a Structure where I'm consolidating the two projects, for one project the component values are updated, but not for the other. I've looked in the issues' histories, and neither show an event for the updated Component values.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Don Utley ,
David from ALM Works here.
Was this a one-off update, or something that will be repeated regularly? If it was the former, please try opening your insert generator and clicking 'Apply' to refresh the data in your structure.
The circumstances for the challenge you have encountered are similar to the others from this thread. The changes you made did not generate an event that Structure listens for. Subsequently, the update was not refreshed in structure and is instead showing the cached data.
Re-Applying the generator should rebuild the structure. Not ideal if this will happen regularly, but will work if this was a one-off.
Please give it a try and let me know if it helps! Looking forward to your feedback!!
Best Regards,
David Niro
www.almworks.com
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the quick reply, David.
This is something that will happen on a regular basis. I was/am puzzled why structure picked up the update on one project, but not on the other. If it's because the triggering event doesn't get generated by updates such as these, then I'd expect we wouldn't see anything in Structure get updated at all. I was hoping to figure out why the one got updated, so I could get them both to.
Checking the issues this morning, I do see the updates in the Structure now. Nothing changed from my end user perspective, so not sure what it was. Perhaps a nightly process or something to that effect triggered the updates.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Don Utley ,
You are very welcome! Apologies for the delay on this one.
It is possible that some other event was recorded in the first project, prompting your structure to refresh and display the new component values.
I am glad to hear that the second is up to date now as well!
One additional option that is available to you, since this will be a a regular update is Clearing Structure Caches.
Please let me know if this helps!
Best Regards,
David Niro
www.almworks.com
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
I am faced with a similar issue where JQL search is not returning correct results, even though reindex code is called..
Is there a solution to this please?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Tasneem,
For us to be able to properly assist you, it would require taking a closer look at your setup and the script you're using. Please submit a support request at our portal at support.almworks.com and we'll get back to you shortly.
Best regards,
Stepan Kholodov
ALM Works
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.