Add an Einstein Discovery Story to a CRM Analytics Template
Einstein Discovery stories can be added to an app template by referring to the story in the template-info.json file.
Create the Story
Before adding the story to a template, create it using Einstein Discovery. (See Create a Story.) We recommend testing your story in CRM Analytics Studio before adding it to a template. Also, add the story JSON to the template. See the following section “Configure a Story” for instructions about editing the story JSON dynamically with a template rule.
Templates only support Einstein Discovery stories with a numeric, binary, and multiclass analysis prediction types in the outcome. The count analysis prediction type isn’t supported.
Note
Reference the Story in template-info.json
To include the story in the template, add the following to template-info.json:
Use caution when adding date fields. Adding a field that shows individual dates (for example, 2019-07-01), isn’t helpful in the story. Instead, it makes more sense to show months.
Multivalue fields can’t be included in a story. They’re excluded from the list in the story UI and must not be added to the story json.
Create or alter the story JSON using template rules. For example, the following rule loops through a measures variable and adds each field to the story JSON:
1{2 "condition": "${!empty(Variables.Dataset_Measures[0].fieldName)}",3 "action": "set",4 "description": "put selected fields in ED Story json",5 "path": "$.setup.fields",6 "value": "${array:union(Rules.CurrentNode, array:forEach(Variables.Dataset_Measures,'{\"type\":\"number\", \"name\": \"${var.fieldName}\"}'))}"7}
Here’s a rule that conditionally adds a competitor name if it’s selected in the wizard: