Step 3: Edit the JSON Files
Your source app looks fantastic, with widgets rendered beautifully in their dashboards. Next, create a template that gives users the same experience as your app but with data unique to their Salesforce orgs. For standard apps, add a configuration wizard to customize app creation. The wizard helps an admin using your template add data, name a dashboard, label a chart, or add their own touches. For embedded apps, add the auto-install.json file. You control the process by editing the files that constitute the template assets, thetemplate-info.json, ui.json, variables.json, and any number of rules.json files. These JSON files open a world of flexibility and power in the template creation universe.
The files interact as follows:
- The
ui.jsonfile uses the variables in thevariables.jsonfile to dictate what goes on each page of the wizard. Theui.jsonfile can contain conditionals that dictate which questions or pages are displayed in the wizard. variables.jsoncontains all template variables, including text for wizard questions and specifications for the answers. The file can also define conditional questions. For example, a question only appears if an org contains certain data. Or if a wizard question is answered in a way that requires more detail, the wizard presents other conditional questions.- The
template-info.jsonfile identifies all the template components, including the references to the rules, variables, and UI files. Thetemplate-info.jsonfile can contain conditionals that dictate whether assets are generated in the downstream app. - The
template-to-app-rules.jsonfiles use variables to set constants, and then use rules to set values that dictate how assets within the downstream app are generated. The most common uses for rules include adding and removing dashboard widgets and dataflow actions. - The
app-to-template-rules.jsonfile defines templatizing the source app. It’s edited only when you change the source app to change the template. - The
folder.jsonfile enables you to set a preferred order of the dashboards in the downstream app, as opposed to leaving them alphabetized. - The optional
auto-install.jsonfile is used when a template is part of a managed package. It defines the auto-install hook and the automated app configuration settings used to generate an auto-install request when the package is installed. This file is created manually, it isn’t generated on template creation.
And yet, editing these JSON files is an optional step. A template is complete even without you touching any of these files. Such a minimal template creates apps that mirror the source app without any customization. You can test your template without any editing to validate that app creation works before moving on to more complex customizations.
Don’t confuse the template assets discussed here with the JSON files representing the source app assets. For example, dashboard_name.json and lens_name.json are also exported as part of the Metadata API retrieval. We recommend that you alter app assets and widgets in CRM Analytics Studio, remembering to update the template object using Analytics Studio to update the template. That means you don’t manually edit their corresponding JSON files.
-
To deliver an optimal user experience, adopt these best practices when creating a wizard.
-
template-info.jsondescribes the template. It references all the information required to create an app from the template. -
The
folder.jsonfile describes thefeaturedAssetsfor the application. -
auto-install.jsonconfigures the template for the auto-install framework. Always create this optional file if you plan to design your template for auto-installation via a managed package with an auto-install request. -
The
org-readiness.jsonfile configures the validations to run on a user org to ensure it can create an app successfully. -
The
variables.jsonfile describes all the variables used in thetemplate-info.json,ui.json, and the differentrules.jsonfiles. -
The
ui.jsonfile determines how your template displays the configuration wizard questions defined invariables.json. -
Rules files define how an app gets created by the template.
-
Use the Apex WaveTemplateConfigurationModifier Class
The
WaveTemplateConfigurationModifierclass checks an org’s data. Also, to simplify app creation, it can modify the template configuration wizard accordingly. -
The
Accessclass provides utility methods to check Integration User access to sObjects and sObjectFields. Use these methods in yourWaveTemplateConfigurationModifierimplementation.