Listener Execution

This article describes the execution order. Learn about the options listeners are opening.

Order of Execution

 

You can use the same event in multiple listener configurations. To do this, add the first listener on the a certain event. Then, add a second script to the a list of events containing the previous event.

To order the scripts, go to Advanced -> Listeners. From the Filter by event box, select the event you want to order the execution for. Then order them as you prefer using the arrows on the right side.

Note: It is always best to have one script per event. This will put all the execution in just one file and will always provide optimal performance.

The order of execution matters only if the execution is synchronous. Otherwise you only configure the triggering sequence.

Asynchronous vs Synchronous Execution

All interactions in Cloud are asynchronous due to us operating independently from Jira and communicating through HTTP calls. As a result, the integrity of data (transactions) can be affected. It is recommended that you minimize the number of calls to improve performance.

Run a listener:

  1. synchronously if fast issue updates are required and the script has short runtime

  2. asynchronously if short update time is not required and the script has long runtime. Make sure to monitor and adjust the thread pool accordingly. Monitor it from Runtime -> Queued Tasks.

 

Asynchronous listeners on Cloud allow you to modify issues directly on them!

Infinite loops

To create an infinite loop between your Jira instance and Power Scripts, enter the following code as a listener on the Issue Commented event. Make sure to run the script in a test instance.

addComment(key, currentUser(), " One new comment !");

Next, add a comment on an issue. Note that the above comment is repeating in a loop. To fix this issue, go to Power Apps Config -> Advanced -> Listeners. Edit the respective listener and disable it.

The infinite loop occurred due to posting the comment using your own user credentials. addComment posts the comment on behalf of the user. The event generated by Jira was counted as a true event. Not all events generated by Power Scripts are overlooked because their usage may be legitimate.

 

 

 

Peacock