# Account-Link Display Option

**URL:** <https://discourse.getcockpit.com/t/account-link-display-option/645>\
**Category:** Support\
**Created:** [March 10, 2019, 7:12pm UTC](https://discourse.getcockpit.com/t/account-link-display-option/645 "2019-03-10T19:12:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![yusufiga](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/yusufiga/32/134_2.png) [@yusufiga](https://discourse.getcockpit.com/u/yusufiga)\
**Post date:** [March 10, 2019, 7:12pm UTC](https://discourse.getcockpit.com/t/account-link-display-option/645/1 "2019-03-10T19:12:44Z")

</div>

Hi,

I’m trying to show “name” when the field is account-link but `"display":"name"` is not working. Is there a way to show name for account-link field in the list?

Thanks

---

<div class="post-metadata">

**Author:** ![raffaelj](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/raffaelj/32/331_2.png) [@raffaelj](https://discourse.getcockpit.com/u/raffaelj)\
**Post date:** [November 22, 2019, 7:55pm UTC](https://discourse.getcockpit.com/t/account-link-display-option/645/2 "2019-11-22T19:55:43Z")

</div>

It’s a while ago, that you posted this thread, but I answered a similar question, I came across your question and I fiddled a bit.

I f you want to populate the name in an api request, have a look here:

> [@How to refer to another Collections or "Accounts"](https://discourse.getcockpit.com/t/how-to-refer-to-another-collections-or-accounts/324/7):
>
> @jingyao97, @boxabrain, @burchaz Please open a new thread if your problem is kind of related, but different. You can link to the related thread instead. Sometimes I’m bored and I scroll through the latest threads - but I don’t often click an threads, that have a solution already… edit: @jingyao97 Sorry, of cause you authored the thread. Please ignore the sentence above. But as always, there are multiple ways to achieve this goal. Do a second api request https://example.com/api/cockpit/list…

If you want to display the name only in entries view `/collections/entries/collection_name`, this might work in `/config/boostrap.php`:

```php
if (COCKPIT_ADMIN && !COCKPIT_API_REQUEST) {

    // only on collections Admin controller
    $app->on('app.collections.controller.admin.init', function() {

        // only after collection "test2" was found
        $this->on('collections.find.after.test2', function($name, &$entries) {

            // ajax request in entries view
            // didn't test with all possible edge cases...
            if ($this['route'] == '/collections/find') {

                foreach ($entries as &$entry) {

                    if (isset($entry['account'])) {
                        $account = $this->storage->findOne('cockpit/accounts', ['_id' => $entry['account']]);
                        $entry['account'] = !empty($account['name']) ? $account['name'] : $account['user'];
                    }
                }
            }

        });
    });

}

```

---

<div class="post-metadata">

**Author:** ![yusufiga](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/yusufiga/32/134_2.png) [@yusufiga](https://discourse.getcockpit.com/u/yusufiga)\
**Post date:** [April 30, 2020, 8:44pm UTC](https://discourse.getcockpit.com/t/account-link-display-option/645/3 "2020-04-30T20:44:29Z")

</div>

Thanks for the answer, an interesting workaround 🙂
