How do you unselect a group from Jira Cloud using Exalate?

Originally asked by David Oosting on 08 September 2021 (original question)


I am attempting to remove a group from the multi-group selector. Trying to do it with labels.

if (nodeHelper.getLabel(“customer_service”) == null) remove group.

How do we tell Jira to remote the group. I have been able to assign the group, but nothing about removing.


Comments:

David Oosting commented on 08 September 2021

Update:

Using the following im unable to null out all groups assigned.

if (replica.labels.findAll { it.label.startsWith(“reassign”) } && !replica.labels.findAll { it.label.startsWith(“customer_”) }) {

issue.customFields."Group Assigned".value \= null

}

Any Idea on how to just null the field you dont want?

David Oosting commented on 08 September 2021

Example of what im attempting to do. For our Jira Cloud Instance, we want to reassign the ticket back to Customer Service in Zendesk. So we add the group assigned to Customer Service along with the group that was assigned originally.

When they CS team reassign back to Jira, we want the Customer Service Group to go away.

Ariel Aguilar commented on 09 September 2021

Hi David,

I would consider to achieve this by doing a custom trigger to something like:

With Exalate you can achieve it, but it will require advanced knowledge on doing API calls. Let me know if this works for you.

Kind regards,

Ariel

David Oosting commented on 09 September 2021

Hey Ariel,

No this is for Jira, so you cant do a trigger. What i have working right now, is to null out the group assigned. My end goal is just remove the Customer Service Group and leave the original group assigned.

if (replica.labels.findAll { it.label.startsWith(“reassign”) } && !replica.labels.findAll { it.label.startsWith(“customer_”) }) {

issue.customFields."Group Assigned".value \= null

issue.customFields."Group Assigned".value ?: \["name":"Service Desk Team"]

}

We tried to add the array value back manually to see if it worked, and it does not.

David Oosting commented on 09 September 2021

Here is the local replica. So we are trying to remove from the array the value with “name”:“Customer Service”

"customFields": {
      "Group Assigned": {
        "id": 10056,
        "name": "Group Assigned",
        "uid": "10056",
        "type": "UNHANDLED",
        "value": [
          {
            "name": "Customer Service",
            "self": "https://atlassian.net/rest/api/2/group?groupname=Customer+Service"
          },
          {
            "name": "Service Desk Team",
            "self": "https://atlassian.net/rest/api/2/group?groupname=Service+Desk+Team"
          }
        ]
      }
Ariel Aguilar commented on 09 September 2021

Sorry, I thought you were referring to Zendesk. Is this custom field a group picker? The payload says it is unhandled, is this custom field inserted by an external plugin?

Kind regards,

Ariel

David Oosting commented on 09 September 2021

Its a group picker, which assigns the ticket to a Jira Group to address. Emails notifications to the group … etc… etc… Custom Field. I had to create.

Ariel Aguilar commented on 10 September 2021

Hi David,

Have you checked on this? :

https://docs.idalko.com/exalate/x/BoEAAg

Kind regards,

Ariel

David Oosting commented on 10 September 2021

We tried that:

def restApiGroup \= \["name":"Service Desk Team"]

issue.customFields."Group Assigned".value \= restApiGroup

Could not update issue `58,775`: Field customfield_10056: Operation value must be an array of group objects. Check the documentation for more details.

Ariel Aguilar commented on 15 September 2021

Hi David,

If you describe a bit more how you tried? What outgoing, Incoming scripts were used? Not sure if I understood what you are trying out here:

    def restApiGroup = ["name":"Service Desk Team"]
    issue.customFields."Group Assigned".value = restApiGroup

Kind regards,

Ariel

David Oosting commented on 15 September 2021

As you can see, the input coming in is a standard array:

"customFields": {
      "Group Assigned": {
        "id": 10056,
        "name": "Group Assigned",
        "uid": "10056",
        "type": "UNHANDLED",
        "value": [
          {
            "name": "Customer Service",
            "self": "https://atlassian.net/rest/api/2/group?groupname=Customer+Service"
          },
          {
            "name": "Service Desk Team",
            "self": "https://atlassian.net/rest/api/2/group?groupname=Service+Desk+Team"
          }
        ]
      }  
  
So what we are trying to do is remove the Value name: "Customer Service" or  set the value to the second in the array.  
The issue.customFields."Group Assigned".value should be assigned to   
  
"value": [ {"name": "Service Desk Team", "self": "<https://atlassian.net/rest/api/2/group?groupname=Service+Desk+Team>" } ]