# Switch logo based on user

**URL:** <https://forums.knack.com/t/switch-logo-based-on-user/8568>\
**Category:** Get Answers\
**Created:** [April 20, 2021, 9:10pm UTC](https://forums.knack.com/t/switch-logo-based-on-user/8568 "2021-04-20T21:10:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![KathyHiggi39830](https://avatars.discourse-cdn.com/v4/letter/k/5fc32e/32.png) [@KathyHiggi39830](https://forums.knack.com/u/KathyHiggi39830)\
**Post date:** [April 20, 2021, 9:10pm UTC](https://forums.knack.com/t/switch-logo-based-on-user/8568/1 "2021-04-20T21:10:17Z")

</div>

I need the ability to display a logo on the page based on which Account is logged in.

I have multiple clients using the same app. User Accounts are tied to Facilities and Facilities roll up to a Company. The logos are stored as an image on the Company record. I need to display the Company logo on each page. The logo needs to be the one for the company they belong to. I have not been able to figure out a way to do this. Has anyone successfully accomplished something similar? &nbsp;I'd love some advice on how to do this.

Thanks.

&nbsp;

---

<div class="post-metadata">

**Author:** ![Tim](https://avatars.discourse-cdn.com/v4/letter/t/ce73a5/32.png) [@Tim](https://forums.knack.com/u/Tim)\
**Post date:** [October 1, 2021, 12:12pm UTC](https://forums.knack.com/t/switch-logo-based-on-user/8568/2 "2021-10-01T12:12:30Z")

</div>

I would utilize this feature as well. Any update?

---

<div class="post-metadata">

**Author:** ![Arjun](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/arjun/32/4149_2.png) [@Arjun](https://forums.knack.com/u/Arjun)\
**Post date:** [October 1, 2021, 1:07pm UTC](https://forums.knack.com/t/switch-logo-based-on-user/8568/3 "2021-10-01T13:07:11Z")

</div>

This code snippet should be able to do it:

```auto
$(document).on("knack-scene-render.any", function(event, scene) {
    $("#kn-app-header").find("img").attr("src", logolink);
});

```

You’ll have to use API calls to get the image file’s url and substitute it with logolink.

---

<div class="post-metadata">

**Author:** ![KathyHiggi39830](https://avatars.discourse-cdn.com/v4/letter/k/5fc32e/32.png) [@KathyHiggi39830](https://forums.knack.com/u/KathyHiggi39830)\
**Post date:** [October 1, 2021, 3:40pm UTC](https://forums.knack.com/t/switch-logo-based-on-user/8568/4 "2021-10-01T15:40:23Z")

</div>

Thanks for the suggestion Arjun.

I created a work around where I put a field for images in the object that contains the company info so that I didn’t have to mess with API calls. I put a Details block at the top of each page that has only that field in it. It’s a bit kludgy but it works!

---

<div class="post-metadata">

**Author:** ![KnackPros](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/knackpros/32/807_2.png) [@KnackPros](https://forums.knack.com/u/KnackPros)\
**Post date:** [December 24, 2021, 8:04am UTC](https://forums.knack.com/t/switch-logo-based-on-user/8568/5 "2021-12-24T08:04:29Z")

</div>

Create a **company logo** field in the **Account** object, then you can get the field anywhere by using this:  
`Knack.getUserAttributes().values.field_123`

To apply this to @Arjun’s example:

```auto
$(document).on("knack-scene-render.any", function(event, scene) {
  const loggedIn = Knack.getUserAttributes()
  if (loggedIn) {
    const logoLink = Knack.getUserAttributes().values.field_123
    $("#kn-app-header").find("img").attr("src", logoLink)
  }
})

```

To get the logo field inside the Account in the first place, you could do one of these:

- Anytime you update the company’s logo—I assume your app has a Form that does this—on that form, create a Record Rule that updates the connected Account.

- Or you might use a Text Formula. Text Formulas have the ability to access a Connected object’s fields. Because Companies are connected to Facilities and Facilities are connected to Accounts, you can access the Company fields through the Account, it’s just a matter of playing around with Connections until the Text Formula in the Account lets you access the Company Logo.
