I would my listener on the sprintCreatedEvent to only be triggered on a certain project. Currently the script below creates a version in a project when there is a sprint created in every project.
{code}
Hi @Atlassian TMG
Could you please share a screenshot of your listener configuration? I am requesting this to check if you have specified the projects you want the listener to work on in the configuration.
I am looking forward to your feedback.
Thank you and Kind regards,
Ram
If you want the Sprint Listener to trigger for specific Projects only, try adding this filter:-
import com.adaptavist.hapi.jira.projects.Projectsdef project = Projects.getByKey('MOCK')if (project.key == 'MOCK') { // Your code}
Please note that the sample code above is not 100% exact to your environment. Hence, you will need to make the required modifications.
I hope this helps to solve your question. :-)Thank you and Kind regards,
Hi @Ram Kumar Aravindakshan _Adaptavist_
I am getting a error.
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script660.groovy: 2: unable to resolve class com.adaptavist.hapi.jira.projects.Projects @ line 2, column 1. import com.adaptavist.hapi.jira.projects.Projects ^ 1 error
@Ram Kumar Aravindakshan _Adaptavist_ we are currently still using script runner 6.57 and we cannot update intill we are migrated to jira cloud which will take a while.
The following makes no sense:
def project = ComponentAccessor.projectManager.getProjectByCurrentKey("INTB2BSSD") if (project.key == 'INTB2BSSD') {
You hardcode a project lookup then check that the project is the one you just hardcoded?
No.
You need to use the information from your event to find your project.
The best way I was able to find to do that is to use the rapidViewId. As far as I know, usually, each rapidVIew (board) should be associated with a single project.
You might need to hardcode that mapping.
For example:
import com.atlassian.greenhopper.api.events.sprint.SprintStartedEventevent = event as SprintStartedEventdef boardProjectMap = [123L: 'PKEY1',345L: 'PKEY2',567L: 'PKEY3',]def boardId = event.sprint?.rapidViewIdif(!boardId) return //nothing to do if we don't know the boardlog.debug "found boardId from the event: $boardId"def projectKey = boardProjectMap[boardId]if(!projectKey) return //nothing to do if the board id didn't map to a projectKeylog.debug "found project key $projectKey from boardProjectMap"def project = ComponentAccessor.projectManager.getProjectObjByKey(projectKey)
the data in boardProjectMap will have to be updated to match your board and project keys
It looks like you're new here. Sign in or register to get started.