Listener implementation examples
This guide provides a step-by-step walkthrough for creating two different types of issue listeners in a system using SIL Manager. You will learn how to set up listeners that automatically add comments when an issue is created and when an issue's fields are updated.
How to create a simple Issue listener
Open the SIL Manager and save the following script as
example1_listener.sil:
//simply adds a comment
addComment(key, currentUser(), "Your description is " + length(description) + " characters long");This script adds a comment to the current issue that includes the length of its description.
Navigate to Power Scripts > Configurations > Automations > Listeners and set up a listener that uses the saved script and the Issue Created event.
To concentrate on testing just this listener, you can disable all other listeners in your Jira.
Navigate to your test project and test the script. Each time an issue is created, the comment should appear in the issue.
How to create an Issue Updated listener
Next, create a second listener to monitor updates on an issue's fields. The listener will be filtered to a specific project to demonstrate its full capabilities.
Open the SIL Manager and save the following script as
example2_listener.sil:
//check if the field of interest was changed
if(project == "TEST" && isIssueFieldChanged("description")) {
//get the change and play !
JFieldChange change = getEventIssueFieldChange("description");
addComment(key, currentUser(), "Field " + change.field + " ( changed by " + change.user + "), old size was " + length(change.oldVal) + " chars, now is " +
length(change.newVal) + " chars");
}
//The following may be used to deal with multiple changes:
//JFieldChange [] arr = getEventIssueChanges();
//if you want to intercept multiple changes, you may get them and process accordingly This script checks if the Description field has been changed in the TEST project. If so, it adds a comment detailing the description's old and new size and the user who made the change.
Remember to replace 'TEST' with the name of your specific project.
Navigate to Power Scripts > Configurations > Automations > Listeners and set up a listener that uses the saved script and the Issue Updated event.
Navigate to your test project and test the script. Each time an issue's description is updated, a comment will appear detailing the old and new size of the description field.
Need support? Create a request with our support team.
Copyright © 2005 - 2025 Appfire | All rights reserved.
