Add a Recipe to a CRM Analytics Template
When a recipe creates a dataset for a CRM Analytics app, the dataset connects the recipe to the folder ID for the app. These recipes are automatically added to the app template when it’s created from the app. Only recipes that run successfully and create a dataset are added to the app template.
If a recipe doesn’t contain a dataset, like a recipe that reads and writes from a connector, there’s no way for the app framework to determine which app the recipe belongs to. To solve this issue, in v55.0 and above, the Connect REST API for creating and updating a template supports a list of recipe IDs in the request.
When the app framework adds recipes to a template, it doesn’t know the order in which the recipes must be run. On template creation, the app framework first adds any recipes specified in the request. Then the framework finds recipes used to create datasets for this app and adds them to the end of the list. If a duplicate recipe ID is specified, the app framework ignores it.
During app creation, the recipes are run in the order in which they’re defined in the template-info.json file. If the recipes must run in specific order, you must edit the template-info.json file manually to put the recipes in run order.
Example
POST /wave/templates/
{
"folderSource": {
"id": "00lxx000000xxxxxx"
},
"name": "myAppTemplate",
"label": "My App Template",
"description": "My app template with recipes",
"recipeIds": [
"05vxx000000xxxxx1",
"05vxx000000xxxxx2"
]
}
PUT /wave/templates/0Nk1k000000xxxxxx
{
"folderSource": {
"id": "00lxx000000xxxxxx"
},
"recipeIds": [
"05vxx000000xxxxx3"
]
}
This request adds another recipe to the existing template. If the recipe exists in the template, the PUT request does a no-op.
Example
sf analytics recipe list
RECIPEID NAME NAMESPACE LABEL STATUS
_________________ _____________ __________________ ______________ _______
05vxx000000xxxxx1 Recipe_One Recipe One New
05vxx000000xxxxx2 Recipe_Two Recipe Two New
sf analytics template create -f 00lxx000000xxxxxx -l "My App Template" -r "05vxx000000xxxxx1, 05vxx000000xxxxx2"
sf analytics template update -t 0Nk1k000000xxxxxx -f 00lxx000000xxxxxx -r 05vxx000000xxxxx3