Understand How Templates Work
Before getting into the details of template development, a bit of architecture to help you understand how apps and templates are related.
You know how a house plan works, right? An architect draws one up, then builders use the same basic plan for several houses, each with their own specific features to suit the buyer. Each house follows the same basic plan, but one combines the kitchen and family room. Or another has extra closets or a larger bathroom. Another has larger windows and more doors. And each of them uses slightly different finishing materials—shingles, stucco, clapboard, brick, wood panels.
That’s the way templates work, too. A development team starts by creating an app—a collection of Analytics datasets, dashboards, lenses, and a dataflow.
They create a template from the app using Analytics Templates, and the template becomes a blueprint for the app. The “plan” for the app is expressed in the form of a template object, which is made up of several JSON files.
Other organizations can then use that blueprint to create their own versions of the app. But they can create the app using data from their Salesforce org according to their own analytics needs. They might want to add Salesforce objects or use custom security settings. Or filter customer data based on different fields or terminology. Or create fewer or more dashboards.
Salesforce has created a wide variety of templates. We started with broad, general-purpose templates that create the Sales and Service Analytics apps. More recently, we’ve added templates for apps with more focused purpose, such as Campaign, Change, Retail Banking, and Health Cloud Analytics.
Each template is based on an app with datasets, dashboards, and lenses created by the Einstein Analytics development team. You use our templates to create your own versions of the apps to analyze Salesforce data. If you’ve spent any time working with Salesforce Analytics, perhaps you’ve created your own apps and your teams are using them as we speak.
One other point about templates: They’re more useful for apps that analyze data from Salesforce. You can create templates for apps that use non-Salesforce data. But they’re much more complex and require more work to get the non-Salesforce data into Analytics. For the purposes of this module, we’re going to use an app that includes only Salesforce data.
You and your analytics team just shed blood, sweat, and tears creating the Execs Only app. With Analytics Templates, you create a template based on the app to save others the trouble you just went through. Creating a template is just part of the process on the way to distributing your app. We don’t show how to create a template here. To jump-start the learning process, we’ve created the templates used for the examples in this module. They’re in the download file we mentioned in the Resources section of the previous unit.
The original app you create is known as the “master app” for the purposes of creating a template. Our master app is the Execs Only app that the DTC CEO is so crazy about. We’ve used that app for all the examples that follow.
As shown here, you can create one template from each master app. Others can then use the template to create multiple instances of the app. (Just in case you were curious, you can’t create a new template based on an app created from a template.)
Templates can include configuration wizards—optional but highly useful additions that let admins customize the app. Wizards guide you through creation of the app, asking you questions about how you store data in your Salesforce org and how you’d like to view the data in your app. You make selections that determine how the app you create modifies the original. Many of the Salesforce templates, for example Sales Analytics, include wizards. It’s likely that every customer creates a slightly or significantly different version of Sales Analytics. But every Sales Analytics customer starts with the same app template.
It’s also likely that you want to let partners use a wizard to set up the Execs Only app to meet their specific Analytics needs. To do that, you modify the JSON files that define the template. The JSON files open a world of flexibility and power in the template creation universe. They contain the instructions the Analytics platform uses to create the app. When you create the Sales Analytics app, Analytics looks at the JSON files’ contents, including your wizard selections. It follows instructions in the JSON to create the app.
You’ll get to know a lot more about the JSON files in the next units. (And if you want to skip ahead, complete details about them and template development can be found in Templates Developer Guide. See the Resources section.) Along the way, we give you examples of how to edit the JSON to create your own templates. You won’t create them yourselves for now—that’s for another day. Toward those ends—and to speed things up—we’ve cheated a little and created a template based on the DTC Execs Only app. Our template creates an app with just the Sales and Pipeline Performance dashboards.
Let’s see how that works!
Log in to the special Developer Edition org you set up in the last unit, and select Analytics Studio from the app picker.
You’re ready to create the Execs Only app from the template.
- Click Create and select App.
- Select Start from Template, then click Continue.
- Look at all the Analytics templates you can choose from! Scroll through the list until you find Execs Only Template 1, select it, and click Continue. Be sure to select Template 1.
- Click Continue until you get to a screen where you can name your app. Enter the name Exec App 1 and click Create. That brings up the app creation progress screen. It shows you what Analytics does behind the scenes while it creates the app.
While waiting for your app to be created (it takes a minute or two—not instantaneous, but a lot quicker than developing your own app!), a brief aside: You probably noticed that Execs Only Part 1 doesn’t have a wizard. That’s because we haven’t added the necessary code to the JSON files to add questions, variables, and so on. We’ll show you how to edit the JSON to add a wizard in the next unit.
Also, normally you wouldn’t have two versions of a template in an org. We’ve provided two versions of the Execs Only app template to demonstrate the power of templates. You’ll see what Execs Only Template 2 does in a later unit.
When you see the message Application Complete at the end of the app creation steps, refresh the page to get to the app. You’ll see something like this:
Your basic version of Execs Only has two dashboards and several datasets. Click Run App at upper right. Now you can see just what the DTC CEO and your partners fell in love with. The dashboard widgets at top, Pipeline Performance and Sales Performance, give a high-level view of how DTC sales are going for the selected period. Further down, lots of detail. And all in a single, scrollable view. Nice!
To see how the dashboard works, change the date filter at the top from This Quarter to This Year. Then click the Pipeline Generated side of the toggle below Top Deals. The widgets refresh themselves based on your selection. You can see why people like this so much—lots of analysis in a couple of visualizations, easy to get different views of it. Cool!
In the next units, we’re going to look closely at the template files themselves. Then, we’ll make the template—and the app you create from it—more fully functional. We’re going to take our basic template and make a few simple, but powerful changes, adding configuration wizard questions that give DTC partners power to customize their version of the app.
For now, answer the questions below to continue the quest to earn your badge.
The first part of the process includes refreshing data and then running your app’s dataflow.
- From Analytics Studio, go to the app picker at upper right and select Trailhead Data Manager. You may have to scroll down to find it.
- Select the Trailhead Data Manager link below Items.
- On the Trailhead Data Manager home page, select Trailhead Data Manager.
- On the next page, click Refresh DTC Data.
- Now run the app dataflow. Go back to Analytics Studio by selecting it from the app picker.
- Click the gear icon in the upper right, and select Data Manager. (You’re opening the Analytics Data Manager, not to be confused with the Trailhead Data Manager.) From the menu in the upper left, select Dataflow View.
- Look for the name of your app. Open the menu on the far right across from the app name, and select Start.
- From the menu in the upper left, select Dataflow View. You can see the status of the dataflow to the right of your app name at the top of the list of jobs. Click the refresh button a few times until the status changes from Running to Successful. (If you see a warning message, ignore it and keep going. It won’t hurt your app’s data.)
Next, you download and import a CSV file called Quota so that data about quotas appears in your app. You also use the Trailhead Data Manager to do that.
- Go back to the Trailhead Data Manager. Click the app picker to find it.
- Click the Quota Data circle, and then click Download Quota CSV.
- Save the file, ‘DTC_Quota.csv’ in your Downloads directory.
- In the app picker, select Analytics Studio and open your app.
- Scroll down to see all the datasets, and locate the Quota dataset.
- Click the arrow to the far right of the dataset name and click Edit. If you’re viewing dataset icons, hover over the Quota dataset, click the arrow in the upper right corner, and click Edit.
- In the next window, click Replace Data in the upper right-hand corner.
- That takes you to the Replace Dataset Data page. Click Select file or drag file here….
- Find and select the DTC_Quota.csv file and click Next.
- Click Next on the next page, too, then Upload File on the next page.
- Finally, click Replace and Got It. (The last few pages let you fine-tune your data before you upload it into a dataset, but that’s a subject for a different day. If you want to learn more about importing data to Analytics, see the Analytics Data Integration Basics Trailhead module.)
- Finally, rerun the dataflow to be sure that the quotas data appears in your app. Repeat Steps 5 through 7.