# How to get variable from environment in pre-req into the value attribute

**URL:** <https://community.postman.com/t/how-to-get-variable-from-environment-in-pre-req-into-the-value-attribute/23198>\
**Category:** Help Hub\
**Tags:** tests, variables\
**Created:** [April 28, 2021, 11:34am UTC](https://community.postman.com/t/how-to-get-variable-from-environment-in-pre-req-into-the-value-attribute/23198 "2021-04-28T11:34:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![USYEromanjelinek](https://avatars.discourse-cdn.com/v4/letter/u/ba9def/32.png) [@USYEromanjelinek](https://community.postman.com/u/USYEromanjelinek)\
**Post date:** [April 28, 2021, 11:34am UTC](https://community.postman.com/t/how-to-get-variable-from-environment-in-pre-req-into-the-value-attribute/23198/1 "2021-04-28T11:34:00Z")

</div>

Hello everyone,

I am pretty new in both automation tests and postman and would appreciate your advice.

I have such request in Pre-req scripts

> pm.sendRequest({
> 
> ```
> url: "https://uuidentity.plus4u.net/uu-oidc-maing02/bb977a99f4cc4c37a2afce3fd599d0a7/oidc/grantToken", 
> 
> method: 'POST',
> 
> header: {
> 
> 'Accept': 'application/json',
> 
> 'Content-Type': 'application/x-www-form-urlencoded'
> 
> },
> 
> body: {
> 
> mode: 'urlencoded',
> 
> urlencoded: [
> 
> {key: "accessCode1", value: "XXX", disabled: false},
> 
> {key: "accessCode2", value: "XXX", disabled: false},
> 
> {key: "grant_type", value: "password", disabled: false},
> 
> {key: "scope", value: "openid https", disabled: false},
> 
> ]
> 
> }
> 
> ```
> 
> }, function (err, res) {
> 
> ```
> pm.environment.set("TOKEN",res.json().id_token);
> 
> ```
> 
> });

And my question is how to use (get) variables stored at the environmental level and use them to “value” to be this script correctly sent. I do not want to use visible passwords in these values.

> ```
> {key: "accessCode1", **value: "XXX"** , disabled: false},
> 
> {key: "accessCode2", **value: "XXX"** , disabled: false},
> 
> ```

Many thanks for your help
