I am working with JetEngine forms and i need to add a dropdown of users to select from in one of the form.

is there any way to do this? i dont see any field type of users and also for the select option. if i choose filled dynamicly i have some pre build functions to get the data but none for the users?

How can I set this dropdown or build a function to be show as one of the dynamiclly generated options?

I have not found much on serching this issue and not in their documentation
['https://Stackoverflow.com/questions/72695685', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2022193/']
Here I got the solution and it works.

```
  const [loading, setLoading] = useState(false);
  const [data, setData] = useState([]);

  const getCMSID = () => {
    let url = `${URL}/store-api/category`;
    let getId = {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
        Accept: 'application/json',
        'sw-access-key': `${API_KEY}`,
      },
    };
    fetch(url, getId)
      .then(res => res.json())
      .then(json => {
        getCMSPage(json.elements[0].cmsPageId);
      })
      .catch(err => console.error('error:' + err));

    const getCMSPage = gId => {
      const cmsUrl = `${URL}/store-api/cms/${gId}`;
      let getcms = {
        method: 'POST',
        headers: {
          'Content-Type': 'application/json',
          Accept: 'application/json',
          'sw-access-key': `${API_KEY}`,
        },
      };
      fetch(cmsUrl, getcms)
        .then(res => res.json())
        .then(json => {
          setData(json.sections);
          setLoading(false);
        })
        .catch(err => console.error('Error:' + err));
    };
  };
  useEffect(() => {
    getCMSID();
  }, []);

```

@credit **Nayeem M. Muzahid**
***useState*** hook is asynchronous. So do not set something using ***useState*** and use it inside the same function. As per your code, you can just use the ID directly without using the set value.

```
 const [loading, setLoading] = useState(true);
const [data, setData] = useState([]);
const [id, setId] = useState(' ');

const getCMSID = () => {
let url = `${URL}/store-api/category`;
let getId = {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    Accept: 'application/json',
    'sw-access-key': `${API_KEY}`,
  },
};
fetch(url, getId)
  .then(res => res.json())
  .then(json => { return setId(json.elements[0].cmsPageId)})
  .catch(err => console.error('error:' + err));

 const getCMSPage = () => {
  const cmsUrl = `${URL}/store-api/cms/${globalID}`;
  let getcms = {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      Accept: 'application/json',
      'sw-access-key': `${API_KEY}`,
    },
  };
  fetch(cmsUrl, getcms)
    .then(res => res.json())
    .then(json => {
      setData(json.sections);
      setLoading(false);
    })
    .catch(err => console.error('Error:' + err));
};
 getCMSPage();
};
 useEffect(() => {
  getCMSID();
 }, []);

```

And use the value of the hook outside the function if you need it.