Remove "Request Participants" using Automation rule?

I am using Jira Service Desk cloud version. The issues created on service desk via email takes the cc into Request participant. I would like to automaticalyy remove some specific participants when the issue is created.

Thanks in advance for the time !

3 answers

0 vote


At the moment within JIRA, there is not a way to add requested participants via automation.  There is a feature request for this over in JSDSERVER-3628    As such I believe the same is true for removing users via this method as well.

However there is a KB that you could use to add users, provided you use the scriptrunner plugin with JIRA and a custom script.  Details on this are in How to Automatically Add Request Participants when Creating an Issue - JIRA KB

It might be possible to use the same steps, but then modify the existing script so that it could be used to either clear that field or remove a specific user depending on your needs.

Any solution? I want to do the same thing, remove Request Participants added from cc in e-mail. By JSON "add" or "set", its the same. It just add chosen user to RP. Can't clear that field. Any advice?

Thank you! 

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);

This causes errors for me, i have no experience with scripts, any ideas? 

2017-11-13 15:18:07,526 ERROR [workflow.ScriptWorkflowFunction]: *************************************************************************************
2017-11-13 15:18:07,526 ERROR [workflow.ScriptWorkflowFunction]: Script function failed on issue: IT-2793, actionId: 1, file: <inline script>
groovy.lang.MissingPropertyException: No such property: event for class: Script5
 at Script5.run(Script5.groovy:14)

Are you using script listener? Event should be a default property.

Suggest an answer

Log in or Join to answer
Community showcase
Emilee Spencer
Published Friday in Marketplace Apps

Marketplace Spotlight: DeepAffects

Hello Atlassian Community! My name is Emilee, and I’m a Product Marketing Manager for the Marketplace team. Starting with this post, I'm kicking off a monthly series of Spotlights to highlight Ma...

50 views 0 3
Read article

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot