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

Thanks @Ankur Bawiskar , gs.info() is my next plan - I will report back soon.

 

gs.info server side produced the following clue:

Andrew_Shaw_0-1749595539384.png


It appears I am returning a sys_id and not the URL to the image that the <img> tag requires.
Now to hunt down that record !!!!!

 

That sys_id points to a record in the sys_attachment table which is apparently where all "Image" type fields are stored.

I checked the article you linked and while I understand its intent, the key piece that is not elaborated on is the statement:

 

data.company_logo_url = 'image URL'// when you get image path


It appears to me that querying the user.company.banner_image_light field in the server script resolves to a sys_id of a record in the sys_attachments table which does not contain the actual URL of the logo image - and I believe this is what I need to get to so my HTML will work !


 

I am still stuck on this !

 

The link you posted above seems to be based around using the portal.logo field which is not what I want.

Brad, SNOW employee suggested the need to create a mapping between the Company Record and the Company logo. I have this already via the OOB offering utilising the UI16 Banner image field on the company record where I have uploaded the logo I need.

That field on the company record stores a sys_id reference to a "banner_image_light" entry in the sys_attachment table.

Referencing that sys_id in my <img ...> tag in my header widget for the portal does not resolve to the actual logo.

I have tried using the getURL() method on a gr query into the sys_attachment table based off the above sys_id, but that returns a null reference when debugged server-side which I imagine is why the <img...> fails.