Header logo not updating

lightblu
Mega Expert

Hi,

I am trying to change the logo of a header. For some reason, the logo won't change no matter what I do. I even made a new header and uploaded a completely different logo to no effect. Where are header logos getting overwritten?

Also, I am talking about the CMS header block as so, not the actual banner image:

For example, the olympic logo below won't change on my CMS page no matter what I do.

find_real_file.png

Thanks.

Message was edited by: Tyler Li

1 ACCEPTED SOLUTION

Looks like the script rendering the image is using a static image instead of the one provided in the record. Search your UI Macros table with filter: XML contains fplogo.png



If you find something you might need to update it to use ${current.logo.getDisplayValue()} instead.



Also, a less clean way to do it as the Header record becomes misleading (and this is why you actually struggle updating a simple image) look for Name contains fplogo.png inside your Image library, if you find it then update it with the new logo. If you don't find it you can create an image record with the name fplogo.png and this should overwrite the existing image.


View solution in original post

20 REPLIES 20

When you say removing the logo, you are talking about the code in the UI Macros or the image in the Header record (using Delete)?



If when deleting the logo then it gets updated, it might be a cache issue. Try to clear your cache to see if the logo is updated.



If clearing the cache solves your issue, here is a fix that you can do to avoid clearing the cache of your users.



Change the code (cms_header_logo UI Macro) that displays the logo to make sure the latest version is used instead of the cache:



<?xml version="1.0" encoding="utf-8" ?>


<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">


  <j:if test="${current.logo.getDisplayValue() != ''}">


    <!-- Retrieve the logo last updated date -->


    <g:evaluate var="jvar_logo_updated_on">


    var attachment = new GlideRecord('sys_attachment');


    attachment.addQuery('file_name', 'logo');


    attachment.addQuery('table_name', 'ZZ_YYcontent_block_header');


    attachment.addQuery('table_sys_id', current.sys_id);


    attachment.query();


    if(attachment.next()){


              jvar_logo_updated_on = attachment.sys_updated_on;


    }


    </g:evaluate>


        <div class="cms_header_logo" >


            <a href="home.do"><img src="${current.logo.getDisplayValue()}?v=${jvar_logo_updated_on}" alt="{gs.getMessage('Home')}" /></a>


        </div>


  </j:if>


</j:jelly>


I mean the image in the header record.



I have tried clearing my cache.



I'm really puzzled right now.


Try this:



  1. Go in your CMS site
  2. Right click the logo and click on "Inspect Element"
  3. Copy the src of the image, it should be a sys_id ending with .iix
  4. In your browser open <instance-name>.service-now.com/the_src_you_just_copied
  5. You should see your old image (not updated), try to add ?v=1 at the end of the URL
  6. If you see the updated image then, it is a cache issue and the code I proposed previously should fix it


If this does not give you the updated image, plese copy paste the XML code of both "render_content_block_header" and "cms_header_logo"


Hi Laurent,



I don't see the sys_id in the image src:



Screen Shot 2016-07-19 at 9.51.04 PM.png


Looks like the script rendering the image is using a static image instead of the one provided in the record. Search your UI Macros table with filter: XML contains fplogo.png



If you find something you might need to update it to use ${current.logo.getDisplayValue()} instead.



Also, a less clean way to do it as the Header record becomes misleading (and this is why you actually struggle updating a simple image) look for Name contains fplogo.png inside your Image library, if you find it then update it with the new logo. If you don't find it you can create an image record with the name fplogo.png and this should overwrite the existing image.