Hey,
I created a "Script Listener" with Scriptrunner for my Jira Cloud project.
Whenever an Issue is created or updated, the script will adapt the summary based on some cool rules. This part is working fine and I'm kinda happy.
However, as I'm changing the summary, the script will call again (as changing the summary is an update).
This second call is just a waste of time, as nothing will be changed, as nothing changed.
Can I somehow avoid it?
I tried 'If the following condition evaluates to true:', hoping it will be my user for the first call and the ScriptRunner user for the second, but it seems to be always the "as this user" user.
Thanks!
Jira fires all the relevant events on a change now, so your listener is simply responding to multiple events. Change the list to just "update", ignore the create event.
The create even isn't a problem. I want to run the script whenever there is a change on the issuse. The first change is the "create".
Whenever something is changed in the issue, I check some custom fields and adapt the summary based on these field. Adapting the summary (via script) is a change on the issue, so the update event is triggered again and the script is executed again. Luckly there is no real change, so no need to change the summary, so no endless loop. But it's 100% unnecessary to run twice.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
When do you want your listener to run? On create, on update or both? If you don't want your script to run on update, then why you don't remove it from the listener? Do you want it to run on update for all e.g. field changes, but the summary?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey @Alex Koxaras -Relational-
I want to run the listener on both (create & update).
The problem is, I change (update) something in the issue inside the script, which will trigger a new update event, resulting in running the script twice. Luckly it's no endless loop, as I don't change something the second run. But no point in running it twice.
I was thinking of checking the "changer/creator" in the "If the following condition evaluates to true" part of the script. As the "changer/creator" would be a user for the first run and the script in the second run. But I don't think the "changer/creator" is available at this point.
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.