We have created our own analytics template. I am trying to add a preview image to the analytics template that can be viewed when creating the analytics app from the template. I've tried adding the image file to images folder and into the parent template folder. Neither worked.

Below is the snippet inside the template-info.json. previewDashboard.png is the image name

"templatePreviews" : 
        "name": "previewDashboard",
        "label": "Wave Analytics Training",
        "description": "Learn about templates to generate Analytics assets.",
        "namespace": "ssAnalytics"

The images need to be static resources in the salesforce instance, rather than part of the analytics template (who thought that was a good idea?!)

Next to your waveTemplates directory in force-app/main/default create a directory called staticresources and put your image file in there. Note if it's a JPG it prefers ".jpeg" as a suffix rather than ".jpg". Also I think that it only allows lower-case names, so your example above wont work.

Create a matching metadata file in the same directory called <myfilename>.resource-meta.xml. E.g. if your image is abc.jpeg, create a file called abc.resource-meta.xml Add the following content to that metadata file:

<?xml version="1.0" encoding="UTF-8"?>
<StaticResource xmlns="http://soap.sforce.com/2006/04/metadata">

Now you can add the templatePreview entry to the template-info.json file; the name value should be the file name without its suffix (E.g. "abc" from my example above). The image should not be declared in the imageFiles section of template-info.json.

You need to deploy to the Org from the force-app/main/default level so that it includes the staticresources directory.

Hope that helps!


| improve this answer | |
New contributor
user86897 is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

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.