Hi
I have written a listener to change the Assignee to component lead when ever component is being changed. I can see in the log and backend script is executing and component owner/assignee is being changed. But on UI unless the project name is mentioned , assignee field value is not being changed.
Is it mandatory to mention the project name for listeners
Hi @Vineela Durbha ,
You should set the project in the listener configuration. Do you mean you needed to mention the project name in the script ?
I am talking about mentioning the project in listener configuration. Actually I have the script which should work for the entire project category.So I am looking for what happens if project name is not added under the listener configuration, as my script should work for the entire project category.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry I completely missed your answer... As Ilya said you could create a listener for all projects and filter the project category in the script itself.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tried the above but it is not working unless and until you provide the project name in script listener UI page
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Vineela Durbha could you please provide a screenshot of you configuration / script ? It would be easier to debug it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please find the attached screenshot . I have tried not to mention any project under projects and because of this assignee value is not getting changed inspite of mentioning that in the script. My script is as below
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.issue.IssueEvent;
import org.apache.log4j.Level
import org.apache.log4j.Logger
Helper helper = new Helper();
log.setLevel(org.apache.log4j.Level.DEBUG)
def issue = event.issue as Issue;
def customFieldManager = ComponentAccessor.getCustomFieldManager();
def changeHolder = new DefaultIssueChangeHolder();
log.debug("project category" +issue.getProjectObject().getProjectCategoryObject().getName())
def components = issue.componentObjects.toList()
if(issue.getProjectObject().getProjectCategoryObject().getName()=="Software - Lightweight"){
if(helper.CheckIfSpecificCustomFieldChangedValue(event,"Component"))
{
log.debug("yes component value is changed")
issue.setAssignee(components?.first()?.componentLead)
log.debug("assignee " +issue.getAssignee().getDisplayName())
}
}
This works only if I mention specific project under projects in Listener UI. But when i try to display the assignee value in the script, I can see the new assignee but the value is not being reflected on UI. So I guess value is getting changed but not being reflected in UI
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
With that current configuration the listener will indeed not execute, kindly try to map it with all projets :
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
With All projects it is not working. I can see that script got executed successfully, but on UI assignee value is not changed.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If I am not mistaken the script should display the assignee if it is updated ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Also you could try to add
import com.atlassian.jira.issue.index.IssueIndexingService
def issueIndexingService = ComponentAccessor.getComponent(IssueIndexingService)
issue.store()
issueIndexingService.reIndex(issue)
after updating the assignee in the script.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
By adding above code script is working for "All projects" under Listener.
Thanks for helping me resolve this issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I guess, since components are bound to a projects, you have to select the context for your listener, "All projects" might work for you (unfortunately, there's no option to select project category).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
All projects is not working unless specific projects are mentioned under Listener in UI ,inspite of mentioning the project category under scripts
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.