The following example shows how a Dynamics CRM Workflow can calculate the portatour® call interval for accounts dynamically.
The call interval is calculated by the workflow according to the annual revenue and is saved in a user-defined field:
Annual revenue | Call interval |
No data | 0 days* |
€0 to €10,000 | 90 days |
€10,000 to €100,000 | 60 days |
more than €100,000 | 30 days |
*) 0 days means: 'do not visit this customer regularly'.
The workflow should be applied if:
- A new account is entered.
- The annual revenue of an account changes.
- The call interval for an existing account is initialized once.
Creating a field
The calculated call interval is saved in a user-defined field of the account entity.
Navigate to Settings - Customization - Customizations - Customize system or create an individual solution for this example (Settings - Customization - Solutions - New) and open this solution.
Navigate to Components - Entities.
Select the entity Account.
If the entity Account is not displayed, select Add available element and select Account. In the window Missing required components select No, do not include required components.
In the component tree on the left, select Fields under the entity Account.
Select New and create the following field:
Label | Calculated Call Interval |
Name | new_CalculatedCallInterval |
Type | Integer |
Minimum Value | 0 |
Maximum Value | 730 |
Save and Close this field
Select in the solution window Publish all customizations.
Creating a workflow
In the component tree on the left, select Process and click on New.
Enter the following settings:
Process Name | Calculate Call Interval |
Entity | Account |
Category | Workflow |
Type | New empty process |
Click on OK.
A window is displayed where the workflow that has just been created can be customized.
Select the following settings:
Activate As | Process |
Available to Run | ✓ As an on-demand process |
Scope | Organization |
Start when | ✓ Record is created ✓ Record fields change |
Under 'Record fields change', click on Select and select the field Annual Revenue.
The following steps must be carried out a total of four times. The first time, select the settings indicated in the text. The other times, select the settings indicated further down.The first time, select the settings indicated in the text.Thereafter, select the settings indicated further down.
Click on Add step in the lower section of the window and select View properties.
Enter New customer as the Name of the step.
Click <Property> (click to Configure)
Enter the following property: Account – Annual Revenue – does not contain data
Save and Close the property
Click on Select this line and click on 'Add step'.
Click on Add step and select Update record.
Enter Call interval: 0 days as the name of the step.
Select in this step Update - Account.
Click on Set properties.
A form with all the fields of the account entity is displayed. Select the field Calculated Call Interval and enter the value 0.
Save and Close the form with the account fields.
Repeat the steps above with the following settings:
Repeat 1:
- Step: View properties
- Name: Annual turnover up to €10,000
- Property: Account – Annual Revenue – Is less than €10,000
- Step: Update record
- Name: Call interval: 90 days
- Value for the field Calculated Call Interval: 90
Repeat 2:
- Step: View properties
- Name: Annual revenue from €10,000 to €100,000
- Property:
- Account – Annual revenue – Is more than or equal to – €10,000
- Account – Annual revenue –Is less than – €100,000
- Step: Update record
- Name: Call Interval 60 days
- Value for the field Calculated Call Interval: 60
Repeat 3
- Step: View properties
- Name: Annual revenue from €100,000
- Property: Account – Annual Revenue – Is greater than or equal to – €100,000
- Step: Update record
- Name: Call Interval: 30 days
- Value for the field Calculated Call Interval: 30
Save the workflow.
Activate the workflow by clicking on Activate in the menu
The following .illustration shows the completed workflow
Initialization of existing accounts
The workflow for calculating the call interval for an account is applied when it is first created or if the annual revenue field changes.
To initialize the calculated call interval for existing accounts according to the annual revenue, carry out the workflow manually for all accounts.
Open a window that displays all the accounts that are to be initialized.
- Option 1: navigate to Workplace – Accounts and select the required display.
- Option 2: open the extended search and select all accounts that are to be initialized.
Select all the records shown.
In the menu, click on Apply workflow, select the workflow Calculate Call Interval and confirm the application of the workflow.
After the workflow has been applied to all these accounts, navigate to the next page of the display and run the workflow again for all the accounts on this page.
Repeat this process, until the workflow has been applied to all the accounts.
As workflows in Dynamics CRM are applied asynchronously, it usually takes a few seconds or minutes for the initialization of all accounts to be completed.
Set the field in the Organization Settings
For portatour® to apply the new field new_CalculatedCallInterval when planning calls, the field has to be selected in the Organization Settings.
In Dynamics CRM, navigate to Settings - portatour® - Administration - Organization Settings and go to the section Planning settings.
Under Call interval remove the check-mark next to Standard and select Calculated.
Under Account field select Calculated Call Interval.
Save and close the window.