How to control the display of the portal header logo by role

HS7
Giga Guru

Hi

I would like to control the display of the portal header logo by role.
I want logo A to be displayed to users with role A, and logo B to be displayed to users with role B.
Isn't the portal header a widget? If it was a widget, I think you could set it to be displayed or hidden by role.

1 ACCEPTED SOLUTION

It is possible to show different logo for each company without creating multiple portals 

1. Navigate to System UI -> Images

Upload logo for each company

2. Create a new system property to map logo for each company

Name - comp.logo.mapping

Description - JSON Key - company sysid
                         JSON Value - image name uploaded in step 1

Value - 

{
"86837a386f0331003b3c498f5d3ee4ca" : "logo1.svg",

"20d5991dd7600200e5982cf65e6103b7":"logo2.png"

}

 

3. Navigate to Service Portal -> Portals and Open CSM portal Theme

Clone the out of the box header widget and update it to the theme

4. Open the cloned header widget

HTML - update the highlighted line

Shruti_0-1753336560484.png

 

5. Add below lines to the server script

     var company_id = gs.getUser().getCompanyID();
    var logo_src  = JSON.parse(gs.getProperty('comp.logo.mapping'));
    data.logo = logo_src[company_id];

 

 

View solution in original post

12 REPLIES 12

Shruti_0-1753273876151.png

Shruti_2-1753274040823.png

 

For CSM , Portal Polaris header widget is associated with the theme

Shruti_1-1753273933763.png

Shruti_3-1753274143283.png

 

 

@Shruti  

Thank you.
Is there only one HTML correction in step 4?
I have the correct image name in data.logo in step 5, but the logo doesn't appear in the portal.

@HS7  Can you please share all the screenshots?

@Shruti  

thank you.

These are the screenshots.

HS7_0-1753332964836.png

HS7_1-1753332976220.pngHS7_2-1753332992494.pngHS7_3-1753333001847.pngHS7_4-1753333016371.png

 

@HS7 Hope you are testing it with https://<instance-name>.service-now.com/test

Try to add logs in server scripts. Make sure the image is correct. If system property is not working try to hardcode image name in server script and test it

Shruti_0-1753335060576.png