# How to find env variable present in my response or not

**URL:** <https://community.postman.com/t/how-to-find-env-variable-present-in-my-response-or-not/3633>\
**Category:** Help Hub\
**Tags:** tests\
**Created:** [December 19, 2018, 9:22am UTC](https://community.postman.com/t/how-to-find-env-variable-present-in-my-response-or-not/3633 "2018-12-19T09:22:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nithin.kanuganti](https://avatars.discourse-cdn.com/v4/letter/n/bbe5ce/32.png) [@nithin.kanuganti](https://community.postman.com/u/nithin.kanuganti)\
**Post date:** [December 19, 2018, 9:22am UTC](https://community.postman.com/t/how-to-find-env-variable-present-in-my-response-or-not/3633/1 "2018-12-19T09:22:03Z")

</div>

Hello Folks,  
I am trying to find an env variable in the response body. Please help me with the test script.  
I cannot do with the specific path. like responsebody.x[0].y …. as I am not sure where the variable will be present in the array of Objects.  
I have stored as env variable data[0].name from each object. Now I have to validate whether these are present in below response or not.

Response has 5 objects . To use responsebody[0].; , objects in array will not be in same order for every request. So my tests are failing.

I just want to see whether the value is present in response body or not.  
[  
{  
“\_id”: “dc-3659e004-6e3f-549c-a453-6cb9a1d5a9c5”,  
“lname”: “jiracommentonissue”,  
“status”: “configured”,  
“streamId”: “st-ff8c06da-15f9-5c0b-b103-4a48a641a778”,  
“name”: “JiraCommentOnIssue”,  
“serviceType”: “rest”,  
“serviceNodeType”: “custom”,  
“type”: “service”,  
“refId”: “abe92694-8597-598f-9cc1-9ebdb4ceafba”,  
“headers”: {  
“type”: “raw”,  
“value”: “{“Content-Type”:“application/json”}”  
},  
“payload”: {  
“type”: “raw”,  
“value”: “%7B%22body%22%3A%22%7B%7Bcontext.entities.JiraTextToComment%7D%7D%22%7D”  
},  
“endPoint”: {  
“host”: “[koreteam.atlassian.net](http://koreteam.atlassian.net/)”,  
“port”: “”,  
“path”: “/rest/api/2/issue/{{context.entities.JiraIssueID}}/comment”,  
“protocol”: “https”,  
“method”: “post”,  
“connectorEnabled”: false  
},  
“idp”: “JiraBasic1319314172\_1544870714130”,  
“authRequired”: true,  
“sbComponentId”: “dc-58447b8a-50b6-5923-a461-464dde0be1f7”,  
“editLocked”: true,  
“state”: 0,  
“lModBy”: “u-9e5ac579-4a7d-5694-ab3b-c4878e906717”,  
“createdOn”: “2018-12-15T10:45:14.600Z”,  
“createdBy”: “u-9e5ac579-4a7d-5694-ab3b-c4878e906717”,  
“serviceAPITimeout”: 20,  
“lMod”: “2018-12-15T10:45:26.000Z”,  
“parentId”: “dc-8398bd6d-43b2-593b-a0b2-391637c81a9a”,  
“label”: “JiraCommentOnIssue”  
},  
{  
“\_id”: “dc-89697f6c-ea2c-58b2-b05e-d597d6354ecf”,  
“lname”: “jiracommentonissueresponse”,  
“status”: “configured”,  
“streamId”: “st-ff8c06da-15f9-5c0b-b103-4a48a641a778”,  
“name”: “JiraCommentOnIssueResponse”,  
“type”: “message”,  
“message”: [  
{  
“\_id”: “mt-1b32bf6b-1556-5b09-bf3d-28b435a8b29d”,  
“channel”: “default”,  
“createdBy”: “u-9e5ac579-4a7d-5694-ab3b-c4878e906717”,  
“lModBy”: “u-9e5ac579-4a7d-5694-ab3b-c4878e906717”,  
“lMod”: “Sat Dec 15 2018 10:45:26 GMT+0000 (UTC)”,  
“createdOn”: “Sat Dec 15 2018 10:45:14 GMT+0000 (UTC)”,  
“streamId”: “st-ff8c06da-15f9-5c0b-b103-4a48a641a778”,  
“parentId”: “mt-633c1cd3-44b6-596c-a185-afd05f028ea1”,  
“text”: “if(context.JiraCommentOnIssue.response.statusCode%20%3D%3D%20201)%0A%7B%0A%20%20%20%20print(%22Comment%20added%20successfully%22)%3B%0A%7D%0Aelse%0A%7B%0A%20%20%20%20print(%22Unable%20to%20add%20the%20comment.%20Returned%20a%20status%20of%20%22%2Bcontext.JiraCommentOnIssue.response.statusCode)%0A%7D%0A”,  
“type”: “uxmap”  
}  
],  
“refId”: “6fd39bc4-f71d-5efd-8681-871ed3bd1c3d”,  
“sbComponentId”: “dc-0198a70b-1a89-5b6b-8d87-d810788859c9”,  
“editLocked”: true,  
“state”: 0,  
“lModBy”: “u-9e5ac579-4a7d-5694-ab3b-c4878e906717”,  
“createdOn”: “2018-12-15T10:45:14.605Z”,  
“createdBy”: “u-9e5ac579-4a7d-5694-ab3b-c4878e906717”,  
“lMod”: “2018-12-15T10:45:26.000Z”,  
“parentId”: “dc-233ed4db-99e2-5379-a8d7-90f5733fbac7”,  
“label”: “JiraCommentOnIssueResponse”  
},  
{  
“\_id”: “dc-baa92073-09d4-5ecd-9164-54b967a41703”,  
“type”: “intent”,  
“editLocked”: true,  
“name”: “Add\_Comment\_to\_Issue”,  
“lname”: “add\_comment\_to\_issue”,  
“createdOn”: “2018-12-15T10:45:14.601Z”,  
“createdBy”: “u-9e5ac579-4a7d-5694-ab3b-c4878e906717”,  
“lMod”: “2018-12-15T10:45:26.000Z”,  
“lModBy”: “u-9e5ac579-4a7d-5694-ab3b-c4878e906717”,  
“streamId”: “st-ff8c06da-15f9-5c0b-b103-4a48a641a778”,  
“state”: 0,  
“refId”: “5fc140c7-cb6a-527a-9541-ce6e22e81a33”,  
“serviceNodeType”: “custom”,  
“spellcorrectThreshold”: 0,  
“status”: “configured”,  
“applyDefaultTemplate”: false,  
“dialogId”: “dg-6470cb70-c35b-5e7d-ad64-ee23d99c1a91”,  
“sbComponentId”: “dc-c0a55bea-de2d-5e70-b94d-7e66ca7af878”,  
“parentId”: “dc-bef61c7c-4db8-5deb-a02f-1850882cbb88”,  
“desc”: “Comment on issue pertaining to Jira”,  
“intent”: “Add Comment to Issue”,  
“dialogRefId”: “f8078186-9e22-55da-ad9e-997cd3002742”  
},  
{  
“\_id”: “dc-d9f55263-c894-50d6-858f-b5e6f3893d72”,  
“lname”: “jiraissueid”,  
“status”: “configured”,  
“streamId”: “st-ff8c06da-15f9-5c0b-b103-4a48a641a778”,  
“name”: “JiraIssueID”,  
“type”: “entity”,  
“message”: [  
{  
“\_id”: “mt-846cbe2f-e1cb-5501-92c6-883ed43ab1cc”,  
“channel”: “default”,  
“createdBy”: “u-9e5ac579-4a7d-5694-ab3b-c4878e906717”,  
“lModBy”: “u-9e5ac579-4a7d-5694-ab3b-c4878e906717”,  
“lMod”: “Sat Dec 15 2018 10:45:26 GMT+0000 (UTC)”,  
“createdOn”: “Sat Dec 15 2018 10:45:14 GMT+0000 (UTC)”,  
“streamId”: “st-ff8c06da-15f9-5c0b-b103-4a48a641a778”,  
“parentId”: “mt-07adbe4c-85eb-5c2f-9a12-ce62fe7e037f”,  
“text”: “Enter Issue ID”,  
“type”: “basic”  
}  
],  
“entityType”: “label”,  
“errorMessage”: [  
{  
“\_id”: “mt-9a8eecf9-3b37-56e5-9fdb-dd314b0255be”,  
“channel”: “default”,  
“createdBy”: “u-9e5ac579-4a7d-5694-ab3b-c4878e906717”,  
“lModBy”: “u-9e5ac579-4a7d-5694-ab3b-c4878e906717”,  
“lMod”: “Sat Dec 15 2018 10:45:26 GMT+0000 (UTC)”,  
“createdOn”: “Sat Dec 15 2018 10:45:14 GMT+0000 (UTC)”,  
“streamId”: “st-ff8c06da-15f9-5c0b-b103-4a48a641a778”,  
“parentId”: “mt-0d330f6e-35d6-56e3-bda9-7fd25d0dea04”,  
“text”: “I’m sorry, I am unable to recognize the company or organization name you entered. Please enter the name of the company or organization you would like to use.”,  
“type”: “basic”  
}  
],  
“refId”: “3e49343f-d066-588a-a270-729d3b874cd1”,  
“sbComponentId”: “dc-b55c3c03-6046-5aa9-9432-69f825733e93”,  
“editLocked”: true,  
“state”: 0,  
“lModBy”: “u-9e5ac579-4a7d-5694-ab3b-c4878e906717”,  
“createdOn”: “2018-12-15T10:45:14.610Z”,  
“createdBy”: “u-9e5ac579-4a7d-5694-ab3b-c4878e906717”,  
“lMod”: “2018-12-15T10:45:26.000Z”,  
“parentId”: “dc-f560ae2a-1177-5ff7-8d98-1ce235c0c737”,  
“label”: “JiraIssueID”  
},  
{  
“\_id”: “dc-f81e4277-500c-5d4b-a684-133a215f5b41”,  
“lname”: “jiratexttocomment”,  
“status”: “configured”,  
“streamId”: “st-ff8c06da-15f9-5c0b-b103-4a48a641a778”,  
“name”: “JiraTextToComment”,  
“type”: “entity”,  
“message”: [  
{  
“\_id”: “mt-e95cdc1c-2f3f-5eca-9a24-5ecb0355acf6”,  
“channel”: “default”,  
“createdBy”: “u-9e5ac579-4a7d-5694-ab3b-c4878e906717”,  
“lModBy”: “u-9e5ac579-4a7d-5694-ab3b-c4878e906717”,  
“lMod”: “Sat Dec 15 2018 10:45:26 GMT+0000 (UTC)”,  
“createdOn”: “Sat Dec 15 2018 10:45:14 GMT+0000 (UTC)”,  
“streamId”: “st-ff8c06da-15f9-5c0b-b103-4a48a641a778”,  
“parentId”: “mt-9d3a9018-6fef-549a-b052-15cb475b3979”,  
“text”: “Please enter the text to comment on the issue”,  
“type”: “basic”  
}  
],  
“entityType”: “label”,  
“errorMessage”: [  
{  
“\_id”: “mt-ab309c7c-0865-560e-97fa-2d52499ddcd0”,  
“channel”: “default”,  
“createdBy”: “u-9e5ac579-4a7d-5694-ab3b-c4878e906717”,  
“lModBy”: “u-9e5ac579-4a7d-5694-ab3b-c4878e906717”,  
“lMod”: “Sat Dec 15 2018 10:45:26 GMT+0000 (UTC)”,  
“createdOn”: “Sat Dec 15 2018 10:45:14 GMT+0000 (UTC)”,  
“streamId”: “st-ff8c06da-15f9-5c0b-b103-4a48a641a778”,  
“parentId”: “mt-9df31441-69c1-51e1-b0a7-cdd056e05727”,  
“text”: “I’m sorry, I am unable to recognize the string. Please enter again.”,  
“type”: “basic”  
}  
],  
“refId”: “cde258b9-e228-50a2-ab8a-f5125452ea61”,  
“sbComponentId”: “dc-f685995e-c5c6-58d3-a7e4-9b485a73003c”,  
“editLocked”: true,  
“state”: 0,  
“lModBy”: “u-9e5ac579-4a7d-5694-ab3b-c4878e906717”,  
“createdOn”: “2018-12-15T10:45:14.611Z”,  
“createdBy”: “u-9e5ac579-4a7d-5694-ab3b-c4878e906717”,  
“lMod”: “2018-12-15T10:45:26.000Z”,  
“parentId”: “dc-33c857b3-27c9-56e4-bceb-cd89f77a39d6”,  
“label”: “JiraTextToComment”  
}  
]
