Is there a way to automatically remove a specific participant from new issues in Service Desk?

Meg Holbrook Community Champion Oct 07, 2016

My team runs a service desk separate from that of another department (Non-JIRA), but both are consistently CC'd on each other's requests from Users.

This creates a situation where our automated emails and notifications are creating additional tickets to that department when issues are moving through our system and being resolved.

Is there a way to automatically remove their account as a participant by email address or some other sort of filtering? We would still need to accept tickets from them as the reporter, which is the sticky part.

I do have to add that we are currently only running on Cloud, so our options are a bit limited.

Thanks for your time!

4 answers

This widget could not be displayed.
Gerry Tan Atlassian Team Oct 10, 2016

How do customer account get created in your JSD project? Do you allow anyone (even those without account) to create request via email?

This widget could not be displayed.
Meg Holbrook Community Champion Oct 11, 2016

Hey Gerry,

Yes, we allow anyone to create a request via email. 

This widget could not be displayed.

Curious if Megan or someone else have firgured this one out? I'd like to remove all request participants in the ScriptRunner postfunction. Any advise would be appreciated.

This widget could not be displayed.

import com.atlassian.jira.event.issue.IssueEvent
import com.atlassian.jira.event.issue.DelegatingJiraIssueEvent
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.fields.layout.field.FieldLayoutItem
import com.atlassian.jira.issue.fields.layout.field.FieldLayoutManager
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.ComponentManager

def issue = event.getIssue()

// Get the list of participants
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def fieldLayoutManager = ComponentAccessor.getFieldLayoutManager()
def requestField = customFieldManager.getCustomFieldObjects(issue).find {((CustomField)it).name == "Request participants"}
def participants = issue.getCustomFieldValue(requestField)
def filteredParticipants = new ArrayList<ApplicationUser>()
if (participants != null) {
for (ApplicationUser participant in (ArrayList<ApplicationUser>)participants) {
if ( participant.getEmailAddress().toLowerCase() != "ADDRESS_I_WANT_TO_FILTER" )
{
filteredParticipants.add(participant)
}
}
}

MutableIssue editableIssue = (MutableIssue)issue
editableIssue.setCustomFieldValue(requestField, filteredParticipants)
Map<String, ModifiedValue> modifiedFields = editableIssue.getModifiedFields();
FieldLayoutItem fieldLayoutItem = fieldLayoutManager.getFieldLayout(editableIssue).getFieldLayoutItem(requestField);
DefaultIssueChangeHolder issueChangeHolder = new DefaultIssueChangeHolder();
final ModifiedValue modifiedValue = (ModifiedValue) modifiedFields.get(requestField.getId());
requestField.updateValue(fieldLayoutItem, issue, modifiedValue, issueChangeHolder);

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

139 views 2 0
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you