-
Notifications
You must be signed in to change notification settings - Fork 10
Template Init Command
This command (sf smockit template init) is used to create templates for generating Salesforce test data. It supports interactive template creation as well as ready-to-use default templates provided by Smock-It.
In interactive mode, the command asks a set of questions to customize the template based on your data requirements, such as objects, fields to include or exclude, record counts etc. After completing the setup, a JSON template is generated and saved in the appropriate folder structure.
In default template mode, Smock-It generates preconfigured, end-to-end templates for common Salesforce processes like Sales Process, CPQ, Health Cloud, and TaskRay, allowing you to create test data within seconds without answering any questions.
In both cases, the generated template defines how objects and fields are populated, excluded, or assigned default values.
-
Creates Folder Structure:
It creates a
data_genfolder in the current directory, along withoutputandtemplatessubfolders. If any of these folders already exist, their creation is skipped. -
Template Setup:
- In interactive mode, Smock-It walks you through a series of questions such as template name, excluded namespaces, output formats (CSV, JSON, or DI), record counts, SObjects, and fields.
- In default template mode, Smock-It skips the questions and directly creates a fully preconfigured template for the selected process.
-
Object-Level Customization:
Interactive templates allow you to customize objects, fields, and record counts per SObject.
Default templates already include predefined object hierarchies and configurations, which can be modified later if needed. - Validation(optional): Once the template setup is complete, it saves the config to a JSON file. You can optionally validate it against a Salesforce org to ensure everything matches your metadata.
- Confirmation: After completion, Smock-It displays a success message along with the location of the generated template file.
Prerequisites
- Smock-it is installed.
Command Execution Format
sf smockit template init [--default] [--salesprocess] [--taskray] [--cpq] [--healthcloud] [--all]After running this command, Smock-It either guides you through interactive setup questions to customize the template or directly generates a predefined default template, depending on the flags used.
| Flag | Shorthand | Required | Description |
|---|---|---|---|
--default |
- |
No | Creates a Default template with predefined configuration. |
--salesprocess |
- |
No | Creates a Sales Process template with predefined configuration. |
--taskray |
- |
No | Creates a Taskray template with predefined configuration. |
--cpq |
- |
No | Creates a CPQ template with predefined configuration. |
--healthcloud |
- |
No | Creates a Health Cloud template with predefined configuration. |
--all |
- |
No | Creates All default templates. |
In this example, we create a default template called default_data_template.json, which defines the structure for generating Account and Lead records, with Account acting as the parent object and Contact as its child. The template generates one Account record with a predefined value for the name field while excluding the fax field. For each Account, one related Contact child record is generated, with specific values provided for LastName and email. Additionally, one standalone Lead record is generated using default field selection behavior. The output is produced in both di and json formats, with pickLeftFields enabled to automatically include remaining eligible fields where applicable.
Executing default init Command
sf smockit template init --defaultAfter executing the default init command: - default_data_template.json will be created at data_gen > templates
{
"namespaceToExclude": [],
"outputFormat": ["di", "json"],
"count": 1,
"sObjects": [
{
"Account": {
"count": 1,
"fieldsToConsider": {
"name": ["John"]
},
"fieldsToExclude": ["fax"],
"pickLeftFields": true,
"relatedSObjects": [
{
"Contact": {
"count": 1,
"fieldsToConsider": {
"LastName": ["Smith"],
"email": ["smith@gmail.com"]
},
"fieldsToExclude": [],
"pickLeftFields": true
}
}
]
}
},
{
"Lead": {
"count": 1,
"fieldsToConsider": {},
"fieldsToExclude": [],
"pickLeftFields": true
}
}
]
}
For the complete question guide, refer to Init Questionnaire Guide.
© 2025 Concret.io, All Rights Reserved. | For a quick demo and guided installation: Schedule a Call. | Smock-it Website