I am testing the ability to add users to the requested participant field using scriptrunner. The concept is check each entry of the Stakeholder Contact field, and if not found in Requested Participant field, add it to the list.
It seems this is close, but I can't seem to figure out why I am getting duplicate entries in the return of the Requested Participant field when testing this.If a user already exists in the Requested Participant field it seems to add them anyway. I would think the if statement would cover that scenario?
import com.atlassian.jira.component.ComponentAccessor;
def issueLinkManager = ComponentAccessor.getIssueLinkManager()
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def stakeholderContact = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Stakeholder Contact"),
requestParticipants = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Request participants")
def sc = issue.getCustomFieldValue(stakeholderContact) as List,
rp = issue.getCustomFieldValue(requestParticipants) as List
sc.each{
if (rp.any {it}) rp << it
}
return rp
This will be a post function, but for this particular context it's in a scripted field (I use these to test results before adding post-functions)
Any help would be appreciated.
I could use behaviours I suppose to do this on a screen, I was just hoping to be able to do it in a post function for mobile compatibility.
Also, of course, to understand why the above code is not working as expected.
Using behaviours is not working because of this issue. Looks like it's back to the original question.
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.