# How to access to which Groups Request Type belongs to

**URL:** https://community.exalate.com/t/how-to-access-to-which-groups-request-type-belongs-to/5605
**Category:** General Questions
**Tags:** cloud-jira, jira-cloud, script, customfields, migrated\_question
**Created:** [November 4, 2024, 8:16am UTC](https://community.exalate.com/t/how-to-access-to-which-groups-request-type-belongs-to/5605 "2024-11-04T08:16:05Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![xl8bot](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/xl8bot/32/324_2.png) [@xl8bot](https://community.exalate.com/u/xl8bot)
#### Post date: [November 4, 2024, 8:16am UTC](https://community.exalate.com/t/how-to-access-to-which-groups-request-type-belongs-to/5605/1 "2024-11-04T08:16:05Z")

</div>

_Originally asked by Vojtěch Veselý on 10 October 2023 [(original question)](https://oldcommunity.exalate.com/questions/95584738)_

* * *

Hello there,

I need to get IDs of Groups to which Request from JSM belongs to. Typically from REST API I could just access the field “Request Type” which has the “groupIds” property. Below is an example how the “Request Type” field looks returned from a REST API.

```auto
{
    "customfield_10010": {
        "_links": {},
        "requestType": {
            "_expands": [
                "field"
            ],
            "id": "166",
            "_links": {},
            "name": "Other",
            "description": "",
            "helpText": "",
            "issueTypeId": "10003",
            "serviceDeskId": "1",
            "portalId": "1",
            "groupIds": [
                "30"
            ],
            "icon": {}
        },
        "currentStatus": {
            "status": "Waiting for support",
            "statusCategory": "INDETERMINATE",
            "statusDate": {
                "iso8601": "2023-10-09T11:24:33+0000",
                "jira": "2023-10-09T11:24:33.295+0000",
                "friendly": "Yesterday 11:24 AM",
                "epochMillis": 1696850673295
            }
        }
    }
}

```

As you can see to access groupIds I would just simply use path customfield\_10010.requestType.groupIds.

How do I achieve that in the outgoing sync script? Tried:

issue.customFields.“Request Type”.requestType.groupIds

issue.customFields.“Request Type”.value.requestType.groupIds

issue.customFields.“Request Type”.value - this returned null/null for some reason even though the script ran on a Request

Thanks

* * *

---

<div class="post-metadata">

### Author: ![xl8bot](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/xl8bot/32/324_2.png) [@xl8bot](https://community.exalate.com/u/xl8bot)
#### Post date: [November 4, 2024, 8:16am UTC](https://community.exalate.com/t/how-to-access-to-which-groups-request-type-belongs-to/5605/2 "2024-11-04T08:16:06Z")

</div>

_Answer by Tomas Eduardo Lalanne on 13 October 2023_

Hi [Vojtěch Veselý](https://community.exalate.com/questions/users?username=vojtech.vesely)!

After some research, we found a way to bring the groupIds.

```auto
def request = new JiraClient(httpClient)
     .http(
                        "GET",
                        "/rest/api/3/issue/${issue.key}",
                        [:],
                        null,
                        ["Accept": ["application/json"], "Content-type" : ["application/json"]]
    )
    {
        response ->
        if (response.code >= 400)
            throw new com.exalate.api.exception.IssueTrackerException("Failed")
        else
            (new groovy.json.JsonSlurper()).parseText(response.body)
    }
def groupIds = request.fields.customfield_10010.requestType.groupIds
replica.customKeys."Group IDS" = groupIds

```

Add this to your Outgoing Script, and it should work to retrieve the groupIds as per your example and be able to send it.

BR

Tomas Lalanne

* * *

---

<div class="post-metadata">

### Author: ![xl8bot](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/xl8bot/32/324_2.png) [@xl8bot](https://community.exalate.com/u/xl8bot)
#### Post date: [November 4, 2024, 8:16am UTC](https://community.exalate.com/t/how-to-access-to-which-groups-request-type-belongs-to/5605/3 "2024-11-04T08:16:07Z")

</div>

_Answer by Vojtěch Veselý on 10 October 2023_

The issue.“Request Type” doesn’t have the “groupIds” property either. IT has just:  
[serviceDeskProjectKey, class, requestTypeKey, serviceDeskProjectName, serviceDeskId, representationValue, requestTypeName, requestTypeId, portalKey]

* * *
