ScriptRunner Behaviour (for issue create) fires issue updated event

I’m using ScriptRunner Behaviours in Jira Cloud.

I have a Behaviour script:

  1. Applied to On Change and On Load.
  2. Alter the value of a field via script: getFieldById(“ID”).setValue(“Value”)

On creating an issue, this behaviour script is fired as expected. What I do not expect is the set value action triggers issue updated event. I thought it was modifying the form field in real time, but instead it looks like it called REST API to set the value.

This is causing problem because I have a ScriptRunner listener for issue updated event. The behaviour script is causing the listener to fire prematurely.

How can I fix this? Can Behaviour script not fire issue updated event? I don’t really want to add another custom field just to tell the listener that the update is from behaviour script.

I noticed something.

The field to be updated by the behaviour, it’s NOT on the issue create screen.

I added the field back to issue create screen, and the extra issue update event disappeared. The field was modified on screen and made it into the created issue.

Is this the expected behaviour? Behaviour would modify field value via JavaScript if field is present, but update the issue after create if the field is absent?

Where can I find documentation on that behaviour?

Hey @KCWongIGSL, this isn’t really the right place to ask about ScriptRunner. You’d have better luck by raising a ticket directly with their support team.