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!
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);
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.
I've written a guide on how to fix the original issue (mentioned on top):
https://community.atlassian.com/t5/Jira-Service-Management/Remove-quot-Request-Participants-quot-using-Automation-rule/qaq-p/460812#U1630417
No "add-ons" needed :P
I hope that helps! :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey Gerry,
Yes, we allow anyone to create a request via email.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
How do customer account get created in your JSD project? Do you allow anyone (even those without account) to create request via email?
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.