8

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?

  • Are there any clues about there the logo is stored when viewing the branding image in use? Maybe an ID in the image url. – Daniel Ballinger Dec 5 '16 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 Dec 6 '16 at 0:01
  • You probably have to use SOAP. How do I access the customer logo in the top left in Apex? – Jonathan Hersh Dec 6 '16 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? – Daniel Ballinger Dec 6 '16 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 Dec 6 '16 at 0:36
6

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.

| improve this answer | |
  • 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? – Christian Anderson Sep 2 '17 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 Sep 2 '17 at 16:50
  • The good thing is that it also supports wildcards: <types> <members>*</members> <name>ContentAsset</name> </types> – Abdel-Ali B. Oct 3 '17 at 9:10
  • @ChristianAnderson I am facing the same issue. Did you find any solution for it? – suban khoja 14 hours ago
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.

| improve this answer | |

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.