cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
pankaj1138
Frequent Visitor

Dynamically Change logo in Power Apps Portal

Hi Experts - We are developing Power Apps Portal for B2B customer and having a requirement to display customer specific logo in portal for every B2B customer login. Can you please suggest, how dynamically we can achieve this requirement ?

 

Thanks

Pankaj

1 ACCEPTED SOLUTION

Accepted Solutions
GauravPandey
New Member

You can add the above logic in the Header within the highlighted div

GauravPandey_0-1664034997205.png

 

View solution in original post

7 REPLIES 7
joaodsantos
Resolver III
Resolver III

Hi,

I'm guessing you are using the account - contact relationship so you should be able to configure the image/logo field on the account and then display that field as an img component on the portal based on who's logged in. Have a look at this on how to do it: https://learn.microsoft.com/en-us/power-apps/developer/data-platform/image-attributes

 

Hope that helps

Hi , Issue is not with storing the logos ... we can store it in web files inside portal management app as well. question is here, where we need to write the logic to fetch the images and show in portal header left side dynamically.

 

Thanks 

Pankaj

Hi @pankaj1138 

 

Once you upload the image as a web file. 

In the portal management app: 

 

1. Under content> web templates > look for "Header" 

2. Choose the appropriate website 

 

ragavanrajan_0-1664008110059.png

 

You can use a liquid templating language using user object 

 

official URL: click here  

 

you can also mix and match liquid and JS together and the page > localised content > custom JS 

 

Sample below. The idea here is if the user belongs to a specific web role (company) then you can display logo dynamically based on the web role. 

 

$(document).ready(function () {
    var roles = "{{ user.roles }}";
    console.log(roles);
    if(roles.contains("Administrators") > 0)
        alert("I am Admin");
});

 

Hope it helps. 
------------

If you like this post, give it a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users to find it.

GauravPandey
New Member

Hi Pankaj,

There is a content snippet 'Mobile Header' that loads image in the portals by default.

You can update the Header template as suggested by Raghav with your logic to update the image dynamically.

You can 

1) create web files with different brand image attached as notes.

2) create html content snippets per brand and refer the image there.

3) Lastly in the Header you can use the liquid if else to include your snippets according to your condition.

{% if user.roles contains 'Role1'%}

{% editable snippets "Brand1" %}

{% elif user.roles contains 'Role2'%}

{% editable snippets "Brand2" %}

{% elif user.roles contains 'Role3'%}

{% editable snippets "Brand3" %}

{% endif %}

 

GauravPandey
New Member

You can add the above logic in the Header within the highlighted div

GauravPandey_0-1664034997205.png

 

Thanks @GauravPandey , this worked.

Cheers!

Helpful resources

Announcements
Carousel Community Blog

Check out the Community Blog

Read all about the most recent blogs in the community!

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Carousel News & Announcements

What's New in the Community?

Check out the latest News & Events in the community!

Users online (3,729)