11

In API 38 (Winter '17), when an "App Branding" image is uploaded through the Lightning Experience UI, the app metadata includes this brand information:

<?xml version="1.0" encoding="UTF-8"?>
<CustomApplication xmlns="http://soap.sforce.com/2006/04/metadata">
    <brand>
        <headerColor>#AF2524</headerColor>
        <logo>CV_CF_Icon_128</logo>
        <logoVersion>1</logoVersion>
    </brand>
    ...

The CustomApplication documentation says that the logo is:

The optional reference to the image document for the application.

But I don't see a Document with a matching name.

Where is this logo image stored, and how can I extract it via the metadata so I can add it to version control and have a working continuous integration deployment from that version control copy?

PS

Used "Search Salesforce" and found it presented as a "File" (a ContentDocument). Is there a good way to get this into version control?

5
  • Are there any clues about there the logo is stored when viewing the branding image in use? Maybe an ID in the image url. Commented Dec 5, 2016 at 22:33
  • @DanielBallinger See the PS - does appear to be a "File". Don't think the metadata API includes that so wondering what is the best way to grab the image.
    – Keith C
    Commented Dec 6, 2016 at 0:01
  • You probably have to use SOAP. How do I access the customer logo in the top left in Apex? Commented Dec 6, 2016 at 0:28
  • I'm sure you could pull the ContentVersion down via either the SOAP or REST API's. Seems like it would be a bit ugly to migrate it that way via Source Control though. How would you then stand up a new org from source alone? You would need to create the ContentVersion record and then put the name into the logo in the metadata. Seems like a weak link. What if the logo name changes? Commented Dec 6, 2016 at 0:31
  • You could store the image in a resources folder alongside the src folder and then have your CI script upload the logo file(s) during the build process. You'd just need to have this resources folder checked into your repository.
    – Mark Pond
    Commented Dec 6, 2016 at 0:36

2 Answers 2

10

When I checked in the app, the Ant deploy error was:

In field: logo - no ContentAsset named CV_CF_Icon_128 found

which a quick Google then revealed this new type name to be added to package.xml:

<types>
    <members>CV_CF_Icon_128</members>
    <name>ContentAsset</name>
</types>

that resulted in a folder called contentassets in the project with a CV_CF_Icon_128.asset file and a corresponding meta file of:

<?xml version="1.0" encoding="UTF-8"?>
<ContentAsset xmlns="http://soap.sforce.com/2006/04/metadata">
    <language>en_US</language>
    <masterLabel>CV_CF_Icon_128</masterLabel>
    <relationships>
        <organization>
            <access>VIEWER</access>
        </organization>
    </relationships>
    <versions>
        <version>
            <number>1</number>
            <pathOnClient>CV_CF_Icon_128.png</pathOnClient>
        </version>
    </versions>
</ContentAsset>

This deployed correctly in the next build.

5
  • I have same been able to deploy too by adding ContentAsset in package.xml. However, in my target sandbox org the Image (png) doesn't show up. I can search and find it in files and it has been deployed. The custom lightning app displays blank whitespace for the icon. Like it is missing. Any ideas? Commented Sep 2, 2017 at 16:38
  • @ChristianAnderson I'm afraid I don't have any ideas - it just worked for me so I never had to look very hard at it.
    – Keith C
    Commented Sep 2, 2017 at 16:50
  • 1
    The good thing is that it also supports wildcards: <types> <members>*</members> <name>ContentAsset</name> </types> Commented Oct 3, 2017 at 9:10
  • @ChristianAnderson I am facing the same issue. Did you find any solution for it? Commented Oct 22, 2020 at 9:32
  • This helped a lot, but I needed to have all 3 of these metadata types included in the package for the branding theme to deploy and show up in the lists: 1) BrandingSet 2) ContentAsset 3) LightningExperienceTheme <types> <name>BrandingSet</name> <members>LEXTHEMINGMyBrandingName</members> </types> <types> <name>ContentAsset</name> <members>Brand_Logo</members> </types> <types> <name>LightningExperienceTheme</name> <members>MyBrandingName</members> </types>
    – Whitzz
    Commented Apr 4, 2022 at 15:44
1

To add to the accepted answer from Keith C:

After modifying package.xml, it was necessary to right click the project folder and click "Force.com" > "Refresh from Server" in order to generate the folder and file.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .