Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Comparing variable and text in iterators gives different results.

Andrey Bushkevich
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 11, 2024

Hello, community.

In my automation rule I'm trying to get ID for reviewer group in bitbucket by its name via REST API.

For web request I'm using /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/settings/reviewer-groups call (see https://docs.atlassian.com/bitbucket-server/rest/7.21.0/bitbucket-rest.html#idp393), which gives me a list of reviewer groups like this:

{
    "size": 1,
    "limit": 25,
    "isLastPage": true,
    "values": [
        {
            "description": null,
            "id": 1,
            "name": "name",
            "scope": {
                "resourceId": 2,
                "type": "REPOSITORY"
            },
            "type": "REVIEWER_GROUP",
            "users": [
                {
                    "name": "jcitizen",
                    "emailAddress": "jane@example.com",
                    "id": 101,
                    "displayName": "Jane Citizen",
                    "active": true,
                    "slug": "jcitizen",
                    "type": "NORMAL"
                }
            ]
        }
    ],
    "start": 0
}

 

The name of the group I want to get ID for is stored in my variable:

variable: groupName
value: QA Team

 

To get group's ID by its name I'm using smart value:

{{#webhookResponse.body.values}}
	{{#if(equals(name, groupName))}}
		{{id}} 
	{{/}}
{{/}}

However, the equals() seems like returns false and I don't get any ID.

I tried this smart value without the variable, and for some reason it works fine

{{#webhookResponse.body.values}}
	{{#if(equals(name, "QA Team"))}}
		{{id}} 
	{{/}}
{{/}}

 

Can anyone help me with that? What I'm missing here?

0 answers

Suggest an answer

Log in or Sign up to answer