Script Runner Behaviour - Issue Creation

Lean Li
Contributor
February 27, 2024

Hi, 

I have a behavior that calculates Risk Level with a behaviour based on Risk Rating, Risk Consequence and Risk likelihood fields. Behaviour works nicely when I update those fields but how can I trigger the behaviour when I create an issue?

Thank you already in a advance!

2 answers

1 vote
Ram Kumar Aravindakshan _Adaptavist_
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 27, 2024

Hi @Lean Li

In your description, you mentioned:-

I have a behavior that calculates Risk Level with a behaviour based on Risk Rating, Risk Consequence and Risk likelihood fields. Behaviour works nicely when I update those fields but how can I trigger the behaviour when I create an issue?

Behaviours can only be triggered on the Create, Edit, Transition and Assign Issue screens.

If you want to automatically "trigger a Behaviour" in this context and set a value to a field upon issue creation, you will need to use either a Post-Function on the Create Transition or Listener, i.e., the Issue Created Event.

Please provide some more information on what type of field you intend to update, and I will try to provide a sample code.

I am looking forward to your feedback.

Thank you and Kind regards,
Ram

 

0 votes
Stefan Stadler
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 27, 2024

Hi,

I would assume this needs to be done in a post-function in the workflow.

There you could use almost the same code as in the behaviour.

Here you can see some examples on custom script post functions as the binding variables slightly differ:

Example Custom Scripts (adaptavist.com)

Hope this helps :-)

Suggest an answer

Log in or Sign up to answer