Displaying a company logo on a Portal page

Andrew_Shaw
Tera Contributor

Hi folks,

My requirement is to have the Logo in my Portal Theme Header vary according to the Company that the logged in user is a member of.
So when I log in as a user of Company X I want to see the header logo as Company X's logo.
Same if I log in as a Company Y user.

I have cloned the appropriate Portal/Theme Header widget so I don't break OOB behaviour.

In my cloned widget I have added Server script to dot-walk from the user record, to the company record and I retrieve 2 different values:

gr.company.getDisplayValue() - returns Company Name as a string - works perfectly

gr.company.banner_image_light - does not obviously fail (but might be silently failing I suppose)

I then also have HTML code in the HTML Template section of the widget:
Displaying the Company name - works as expected
Displaying the Company logo - only produces the alt attribute text I defined in the <img> element

My company definitely has the logos defined - I uploaded them to the Company record (both UI16 banner image and Banner image, to be sure to be sure !!!)

I am passing the values I retrieved from the server script up to the HTML via the standard "data.new_field_name" trick.
- set in the server script
- retrieved in the HTML code as {{data.new_field_name}}
-- company name is shown as straight HTML and works fine.
-- the logo I am attempting to show inside an <img> tag, but all I see is the alt text.

I believe the image fields store a link to the image as a URL, but I am unable to locate the images in the db_image table so I am wondering if that may be my problem. I uploaded the logos via the Company form and my assumption is they will land where they need to. A list view of the company record shows the image logos as expected.

I am pretty sure I missing something really dumb !!!!

Any tips / pointers would be very well received !!!!!

Thanks

 

10 REPLIES 10

Andrew_Shaw
Tera Contributor

Correction - My HTML code to display is actually {{::data.new_field_name}}

My apologies, I omitted the colons from my post.

 

@Andrew_Shaw 

so is it working fine?

are you able to fetch the correct image? did you print that in server side?

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi Ankur,

 

No, the image is not displaying on the portal page.
I have not tried printing the image on server side though - not sure how I would do that, but it is a good idea.

 

Regards,

 

Andrew

 

@Andrew_Shaw 

use gs.info() to print in server side and check in system logs

check if this link helps

Dynamic Logo on Service Portal 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader