Configure Opportunities
Define the general configuration of opportunities on your instance:
- configure the stages through which opportunities progress;
- create templates for task chains to automate the processing of opportunities;
- add scripts for the templates to automatically perform the required logic when opportunities reach certain stages.
Opportunity stages
Prior to the start of the work, you can configure records of the Opportunity Stage (crm_opportunity_stage) table by adding new stages or editing the existing ones. The "out-of-the-box" B2B CRM application provides default opportunity stages described in the Process Opportunities article.
Roles required: crm_admin, admin can create, edit, and delete records. Users with any other "out-of-the-box" B2B CRM role can only read the table's records.
To create an opportunity stage, complete the steps below:
- Navigate to CRM → Settings → Opportunity Stages.
- Click New and fill in the fields.
- Click Save or Save and exit to apply the changes.
Opportunity Stage form fields
Field | Mandatory | Description |
---|---|---|
Name | Y | Add the title of the opportunity stage. |
Minimum probability of opportunity, % | N | Specify the minimum probability of closing the deal in percentage from 0 to 100 for the opportunity to take this stage. |
Customer centric stage | N | Specify the customer centric stage, in which this opportunity stage is included. |
Task chains
The tasks can be created automatically when an opportunity moves to a new sales stage. It allows for automation of business processes. For such tasks, some of the fields are completed automatically: Related record type = Opportunity, Related opportunity, and other fields the completion of which is configured in the template. Use the Opportunity Task Template (crm_task_template) table to configure this system.
Roles required:
- Create, edit – crm_manager, crm_admin, admin.
- Read – users with any "out-of-the-box" B2B CRM roles, admin.
- Delete – crm_admin, admin.
To create an opportunity task template, complete the steps below:
- Navigate to CRM → Settings → Task Chains.
- Click New and fill in the fields.
- Click Save or Save and exit to apply the changes.
Opportunity Task Template form fields
Field | Mandatory | Description |
---|---|---|
Active | N | Select the checkbox to make the template active. An active template automatically creates tasks when the opportunity is moved to the specified initiating stage and the task creation condition is fulfilled. |
Name | Y | Add the title of the task template. |
Table | Y | The table, to which the task created from this template is added. The field is filled in automatically with the value Task (crm_task). |
Description | N | Add the description of the template. |
Task template | N | Configure the values for the fields of the task created from this template. You can only specify the values for the fields of the specified Table. You can read about the Task form in the Related Actions article. If the Do not create task checkbox is selected, the field is read-only. |
Execute action | N | Select the checkbox to run a script specified in the Action field when the task is created from this template. |
Action | Y | Specify the script to run when a task is created from this template. The Action field is only available if the Execute action checkbox is selected. |
Sales direction | Y | Specify the sales direction for the opportunities of which to apply the template. The system automatically fills in the field with the first found sales direction of the current user, but you can change this value. |
Initiating stage | N | Specify the opportunity stage the transition to which initiates the creation of the task from this template. If this field is empty and the current record is not specified in any other record as the Next task template, the tasks will not be created from this template. If the current record is specified as the Next task template in another record, the field is hidden from the form. For such records, you will see a corresponding label on the form. |
Time for completion in workdays | Y | Specify the time to complete the task created from this template. Default value: 3. |
Sort order | N | Specify the order of the task in the task chain. This number does not affect the execution order, but you can use it to sort task templates in the list. Default value: 10 or the value in the previous record + 10, if you create the new record through the Next task template field. |
Next task template | N | Specify the template that should be used to create the next task in the chain after the task created from the current template moves to the Completed state. You can only select a template that meets all of the following conditions:
If the Do not create task checkbox is selected, the field is read-only. |
Task creation condition | N | Specify the condition that needs to be met for the task chain to be launched and the tasks to be created from the template in the condition builder. The condition works only for the first template in the chain when the Initiating stage is reached. If the record is specified as the Next task template in another record, the field is hidden from the form. For such records, you will see a corresponding label on the form. |
Do not create task | N | Select the checkbox to execute the script specified in the Action field when the task chain is launched but not create a task from the template. When the checkbox is selected, the Next task template field is cleared and it becomes read-only. The Do not create task field is available only if the Execute action checkbox is selected. |
Related lists
- Previous Task Templates – the list of templates in which the current template is specified as the Next task template.
Script actions
You can configure the scripts that should be run when a task is created from a template. It allows for the automation of the opportunity processing. Use the server API methods to create the scripts.
Roles required: crm_admin can create, edit and delete records. Users with the crm_read_admin and crm_manager roles can read the records and the values of all fields except for the Script.
To create a CRM Script Action (crm_script_action), complete the steps below:
- Navigate to CRM → Settings → Script Actions.
- Click New and fill in the fields.
- Click Save or Save and exit to apply the changes.
CRM Script Action form fields
Field | Mandatory | Description |
---|---|---|
Name | N | Add the title of the script action to identify it on the Opportunity Task Template form. |
Active | N | Select the checkbox if the script action is active. An active script action can be selected on the Opportunity Task Template form. |
Description | N | Add the description of the script action. |
Script | N | Add the script action. You can use methods of the Server-Side API for the script configuration. |
(function executeCRMAction(opportunity, crmTask, employee) {
opportunity.additional_comments = "Comment was added by CRM Action Script";
opportunity.update();
crmTask.additional_comments = "Comment was added by CRM Action Script";
crmTask.update();
crmTask.additional_comments = employee.display_name;
crmTask.update();
})(opportunity, crmTask, employee);