# Automatically generate AccountLink field value

**URL:** <https://discourse.getcockpit.com/t/automatically-generate-accountlink-field-value/2013>\
**Category:** Support\
**Created:** [July 21, 2021, 2:09pm UTC](https://discourse.getcockpit.com/t/automatically-generate-accountlink-field-value/2013 "2021-07-21T14:09:23Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![ronaldaug](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/ronaldaug/32/260_2.png) [@ronaldaug](https://discourse.getcockpit.com/u/ronaldaug)\
**Post date:** [July 22, 2021, 3:12pm UTC](https://discourse.getcockpit.com/t/automatically-generate-accountlink-field-value/2013/2 "2021-07-22T15:12:10Z")

</div>

> [@snewmn](#):
>
> Ive tried fetching the newly created account \_id after creating, then posting to the new entry field but no luck.

If I am not wrong, you are missing something here. I often try like this and it works.

```javascript

fetch('https://example.com/api/collections/save/consumers?token=12345678901112131415', {
    method: 'post',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({data: {
      "ass_consumer": "_id of your newly created account",
     // the rest fields
      }})
})
.then(e => e.json())
.then(res => console.log(res));

```

---

_[View the full topic](https://discourse.getcockpit.com/t/automatically-generate-accountlink-field-value/2013)._
