I have question. I trying build custom layout for my napili community but In different communiy I need different logo.

Could I get this logo via attribute or something else ?

enter image description here

I added logo to the communities and try this code but steel I don't have logo ...

public static Map<String,String> getBranding() {
    Map<String,String> branding =  new Map<String,String>();
    Id communityId = Network.getNetworkId();
    List<CustomBrand> CustomBrandId = [ select id from CustomBrand where ParentId =: communityId Limit 1];
    for(CustomBrandAsset asset : [select id, AssetCategory, CustomBrandId, TextAsset from CustomBrandAsset where CustomBrandId =: CustomBrandId[0].Id]) {
    return branding;

and my output is JSON

"objectBranding" : {
    "MotifZeronaryColor" : "#51606E",
    "MotifPrimaryColor" : "#1797C0",
    "MotifSecondaryColor" : "#51606E",
    "MotifTertiaryColor" : "#DDE4E9",
    "MotifQuaternaryColor" : "#B1BAC1",
    "MotifZeronaryComplementColor" : "#FFFFFF",
    "MotifPrimaryComplementColor" : "#FFFFFF",
    "MotifTertiaryComplementColor" : "#222222",
    "MotifQuaternaryComplementColor" : "#222222"
  • 1
    If you have 2 different communities why can't you just upload the logos for each one separately from Community Builder? – Dave Humm Sep 15 '17 at 14:19
  • 2 communities is just only example if you need can be 99 communities where we should use one layout with different communities:) I need display image from this branding to the my custom layout. I know that this is posible but I can't find solution for it yet. – JJanek Sep 15 '17 at 14:28
  • I know that it is possible to use a Lightning Component for the layout which can be reused in different communities with the image stored in a static resource and pulled in to the template from their rather than in each community. I don't have access to the code for this at the moment, so I can't post a proper answer till later, but it is possible. – Dave Humm Sep 15 '17 at 14:31
  • @JJanek with a minimum effort, you should be able to right click on the image from a community and fetch the url path from an uploaded resource....I encourage you to try. – glls Sep 15 '17 at 14:33
  • I don't know if I correct undestood you :) I as developer can hardcode it or using static resource. But I prepare this for people who will manage communities - they are only use community builder branding to define all - font, colors, logos. – JJanek Sep 15 '17 at 14:37

The company logo and backgrounds are images stored in the assets library. enter image description here

You should be able to easily fetch them using Apex and in return expose them using a design file either in a custom theme layout or a component or reference them directly using an attribute as a background or logo in your component.

enter image description here enter image description here

So, yes, this is possible. you just need to code the solution.

  • Actualy I found path to the standard objects like;CustomBrand and CustomBrandAsset and I know that there are stored my pictures ;) So when I coded this I put answear : ) – JJanek Sep 20 '17 at 9:06
  • I believe those are only applicable for Salesforce1 – glls Sep 20 '17 at 13:22
  • Hm, I updated my question with code and output ... I don't know what i did wrong. – JJanek Sep 20 '17 at 19:35
  • CustomBrand and CustomBrandAsset are for Salesforce1, not Lightning communities – glls Sep 20 '17 at 19:37

I find solution without apex.

To display logo on my component when I use napili community template should add below code to lightning component:

<div class="capricornThemeLayout siteforceNapiliBody" aura:id="baseThemeForm">
  <div class="capricornContainer">
    <div class="capricornNavBar">
      <div class="cBrandingLogo"></div>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.