Calculated Fields are fields in an App that automatically perform calculations based on specified criteria. They derive their values from other fields within the App and update in real-time as the reference data changes.
Some common examples of calculated fields include:
- Last Communication- This field automatically calculates the amount of time that has elapsed since an Account was last contacted. It is often used by customer success teams to track engagement.
- Number of Interactions- This field automatically calculates the number of interactions (calls, emails, meetings) a Contact has had with your company. It is often used by sales organizations to track touchpoints between sales reps and prospects.
- Total Cost- This field automatically calculates the total cost of a product after service fees, discounts, and taxes.
Creating a Calculated Field follows the same process as creating any other Form Field in FreeAgent, plus a few extra steps. See How to create a new form field for more.
User Permissions: Only Administrators can use this feature.
This article covers the following topics:
- Conceptualize the Calculated Field
- Navigate to Form Fields
-
Add Field
- Field Types for Calculated Fields -
Fill out the Field form
- Field Name
- Field Description and Field Hint
- Section
- Type
- Show Advanced Settings
- Default Value
- Calculate
- Calculation Type
- Dynamic
- Count
- Max/Min
- Formula
- Script
- Sample Scripts
- List Total (sum of Lines)
- Discount Total (calculate a discount value based on Lines)
- Net Gains (equation of Currency Fields)
- Net Total (equation of Lines and Currency Fields)
- Time to Resolution (time elapsed)
- Full Name (combine text fields) - Required
- Lock After Create
- Unique field- Format Mask
- Unique field- Related Apps
- Save
Calculated Field example: Last Communication
Calculated Field example: Number of Interactions
Calculated Field example: Total cost
FAQs
What is a Calculated Field?
Calculated Fields are fields in FreeAgent that automatically perform calculations based on specified criteria.
What types of fields in FreeAgent can be Calculated Fields?
See Field Types for Calculated Fields.
Are Calculated Fields calculated and updated automatically?
Yes. Calculated Fields in FreeAgent are calculated and updated automatically, in real-time.
Can I create my own Calculated Fields?
Yes. See Create a Calculated Field.
Do Calculated Fields require code?
Only Calculated Fields that use Script require code.
Why does my Calculated Field give me a “Not a valid function” error message?
There can be many reasons for a “Not a valid function” error message. Contact your FreeAgent Account Manager for assistance.
Why is my new Calculated Field not providing a value?
A Calculated Field will not be initiated until the first time the data used by the Calculated Field is updated. For example, a Calculated Field that tracks the number of phone calls a sales rep makes to a prospect will not initialize until the first time a phone call is made after the Calculated Field has been created.
Can I delete a Calculated Field?
No. Fields in FreeAgent can be Deactivated but not deleted. See Deactivate a Calculated Field.
Create a Calculated Field
Creating a Calculated Field is similar to creating any other form field in FreeAgent. Let’s go through it step-by-step.
1. Conceptualize the Calculated Field
Before you create a Calculated Field, it is important to have a clear idea of what you want the field to do so that you can determine how best to do it. Start by asking the following questions:
Question 1- What do I want the Calculated Field to do?
Question 2- What App should I create the Calculated Field in?
Question 3- What fields in that App will provide data for the calculation?
Question 4- What Activities (Tasks, Emails, Phone Calls) will provide data for the calculation?
For example, if you want to create a Calculated Field that calculates the total cost of a customer order after a service fee is applied, your answers might look like:
Question 1- What do I want the Calculated Field to do?
Answer- Add up the price of the product and service fee.
Question 2- What App should I create the Calculated Field in?
Answer- The Orders App (this a common App for businesses that sell products directly to customers but the names of Apps in your own setup may vary).
Question 3- What fields in that App will provide data for the calculation?
Answer- The field that contains the price of the product and the field that contains the price of the service fee.
Question 4- What Activities (Tasks, Emails, Phone Calls) will provide data for the calculation?
Answer- None. This Calculated Field will use the App fields mentioned in Answer 3.
Once you have answers to these questions, you can create your Calculated Field in FreeAgent.
2. Navigate to Form Fields
To create a Calculated Field in FreeAgent, go to the From Fields tab of the App Settings for the App you want to create the Calculated Field in. There are two ways to access Form Fields.
1. From the Navigation Menu, go to Settings > Apps and select the App you'd like to create the Calculated Field in. Select the Form Fields tab from the menu bar across the top of the App Settings page.
2. From the Apps Home Page, hover your cursor over the App icon you'd like to create the Calculated Field in and click the gear icon in the top right corner.
Select the Form Fields tab from the menu bar across the top of the App Settings page.
3. Add Field
In the Form Fields tab of the App Settings menu, click the Add Field button at the top of the page.
This will pull up the Select Field Type menu.
Select the Field Type for your Calculated Field. Your choice should be based on the way you want the value displayed.
For example, if you want to create a Calculated Field that automatically calculates the number of interactions your sales reps have had with a prospect, you would choose a Number field because you want the value expressed as a simple number.
If you want to create a Calculated Field that automatically calculates the total cost of a product or service after a discount has been applied, you would choose a Currency field because you want the value expressed as a dollar amount.
Field Types for Calculated Fields
The following Field Types can be used for Calculated Fields:
- Currency
- Date
- Date Time
- Image
- Number
- Duration
- Percent
- Phone
- Text
- URL
4. Fill out the Field form
When you choose a Field Type, the Field form will appear. Regardless of the Field Type you choose, the Field form will have the following fields.
Note: Some Field Types will have unique fields in the Field form.
Field Name
The Field Name field allows you to name the Calculated Field.
The name of the Calculated Field should be simple and informative, telling you what value the Calculated Field is calculating.
Number of Interactions and Total Cost are good examples of Calculated Field names.
This is a required field (*).
Field Description and Field Hint
The Field Description field allows you to provide a brief description of the Calculated Field. The Description will be displayed under the field when you are editing it.
The Field Hint field allows you to provide a hint about the Calculated Field. The Hint will be displayed inside the field when no value is entered.
Calculated Field descriptions and hints should be short, no more than a sentence.
Section
The Section field allows you to designate what section of the App the Calculated Field will be displayed in. The options available are presented as a drop-down menu populated with the sections in the App you are creating the Calculated Field in.
Type
The Type field will already be populated with the Field Type you selected in step 3.
This is a required field (*).
Show Advanced Settings
Select the Show Advanced Settings box to open the Additional Settings section of the Field form.
Default Value
The Default Value field should be left blank when making a Calculated Field.
Calculated
The Calculated field allows you to designate the field as a Calculated Field. This field is set to No by default for all fields in FreeAgent and will have to be changed to Yes when creating a Calculated Field.
When the Calculated field is marked as Yes, a new field called Calculation Type will appear.
Calculation Type
The Calculation Type field is a dropdown menu with 3 options: Dynamic, Formula, and Script.
Dynamic
The Dynamic Calculation Type is used for Calculated Fields that require something to be counted sequentially. Common examples include:
- Number of emails sent
- Number of tasks performed
- Number of days since an action was taken
Note: The Dynamic Calculation Type can only be used with Number, Date, and Date Time Field Types.
When the Dynamic Calculation Type is selected, a new field called Functions will appear.
Functions
The Functions field is a dropdown menu with 3 options: Count, Max, and Min.
Count
The Count Function is used for the Number Field Type.
Max/Min
Max and Min are used for Date and Date Time Field Types. Max calculates the amount of time elapsed from the most recent event, while Min calculates the amount of time elapsed from the earliest event.
For example, if you want to track the time elapsed since the last interaction with a customer, choose Max. Alternatively, if you want to see how much time has elapsed since the first interaction with a customer, choose Min.
Formula
The Formula Calculation Type is used for Calculated Fields that require simple equations. Common examples include:
- Calculating the sum of multiple fields
- Calculating the percentage of a value in another field
When the Formula Calculation Type is selected, a new field called Formula will appear. This is where you input the Formula for the equation you want the Calculated Field to run.
When inputting the Formula, FreeAgent has done much of the work for you. Just type the first few letters in the name of a field you want to include in the equation and the code snippet for that field will populate a dropdown menu. Select the field you want and the code snippet will populate the Formula field automatically.
This means all you have to do is create the equation like you would any basic math problem.
For example, if you want to create a Calculated Field that calculates the total cost of a customer order after a service fee is applied, your equation might look like this:
Price of Product + Price of Service Fee
To enter that into FreeAgent, you would first select the field that contains the price of the product, input the + symbol, and then select the field that contains the price of the service fee.
After inputting the equation into the Formula field, you can test it by clicking the Test button under the bottom left corner of the Formula field. This will pull up the Test Calculation window.
When you select the Record field in the Test Calculation window, a dropdown menu will appear that contains all the records for the App you are creating the Calculated Field in. Select a record and click the Run button in the bottom right-hand corner of the Test Calculation window.
Note: Formulas only support the following field types: Duration, Number, Currency, and Text.
Script
The Script Calculation Type is used for Calculated Fields that require calculations to be run based on specified variables. These are more complex than the Formula or Dynamic Calculation Types and require knowledge of JavaScript.
Note: We recommend reaching out to your FreeAgent Account Manager for help creating Calculated fields using Scripts.
Sample Scripts
The following Scripts are examples you can use as a basis for your own Calculated Fields in FreeAgent. You will have to substitute your own fields and dependencies in place of the ones provided.
List Total (sum of Lines)
The List Total Calculated Field Script is an example of a Calculated Field that sums the Lines in an App record. Refer to the Lines article in the FreeAgent Knowledge Base to learn more about Lines in FreeAgent.
Discount Total (calculate a discount value based on Lines)
The Discount Total Calculated Field Script is an example of a Calculated Field that calculates a discount value based on the Lines in an App record.
Net Gains (equation of Currency Fields)
The Net Gains Calculated Field Script is an example of a Calculated Field that creates an equation between Currency Fields in an App record.
Net Total (equation of Lines and Currency Fields)
The Net Total Calculated Field Script is an example of a Calculated Field that creates an equation between Lines and Currency Fields in an App record.
Time to Resolution (time elapsed)
The Time to Resolution Calculated Field Script is an example of a Calculated Field that calculates the time elapsed from the creation of a record to when that record is moved to a designated stage.
Full Name (combine text fields)
The Full Name Calculated Field Script is an example of a Calculated Field that combines text fields in an App record.
Required
The Required field allows you to designate the field as a required field. This means the field must have a value before an App record can be saved. This field is set to No by default for all fields in FreeAgent and should be left as No when creating a Calculated Field.
Lock After Create
The Lock After Create field allows you to lock this field after a value is entered. This field is set to No by default for all fields in FreeAgent and should be left as No when creating a Calculated Field.
Note: Calculated Fields can’t be adjusted manually and so function like locked fields regardless of this setting.
Unique field- Format Mask
Note: This field will appear in the Additional Settings section of the Field form when you select the Number, Date, or Date Time Field Types.
The Format Mask field allows you to define how numerical data will be presented in the field. For example, you can designate how many decimal places a number will round off to (0.00 is common) or designate how a date will be displayed (mm/dd/yyyy is the American standard).
Learn more about Format Mask syntax at Moment.js.
Unique field- Related Apps
Note: This field will appear when you select the Dynamic Calculation Type and is only used for the Count function.
The Related Apps field allows you to designate what Activity Apps to include when creating a Calculated Field to count activities. The options available will be presented in a dropdown menu populated with all Apps in your FreeAgent instance (only Activity Apps should be selected).
For example, if you want to create a Calculated Field that counts the number of phone calls your sales reps are making to prospects, you would add the Phone Call Activity App to the Related Apps field.
Save
To save the Calculated Field, click the Save button in the bottom right-hand corner of the Field form.
Note: The Type and Calculated fields can’t be edited after saving.
Deactivate a Calculated Field
To Deactivate a Calculated Field, navigate to the Form Fields tab in the App Settings of the App that contains the Calculated Field and hover over the Inline App Actions button of the Calculated Field you want to Deactivate.
A dropdown menu will appear with an Edit button and a Deactivate button. Click the Deactivate button.
A Deactivated field will be automatically moved to a separate Deactivated Fields list for that App.
Show Deactivated
To see the Deactivated Fields list for an App, click the Show Deactivated box in the top-right corner of the Form Fields page.
Calculated Field example: Last Communication
Let’s create a Calculated Field called Last Communication.
Question 1- What do I want the Calculated Field to do?
Answer- Calculate the time elapsed since the last communication (phone call, email, text message) with a Contact.
Question 2- What App should I create the Calculated Field in?
Answer- The Contacts App (or whatever App you use to store your contact records)
Question 3- What fields in that App will provide data for the calculation?
Answer- None. This field will draw data from Activity Apps.
Question 4- What Activities (Tasks, Emails, Phone Calls) will provide data for the calculation?
Answer- Phone Calls, Emails, and Texts.
With these questions answered, we can begin to create the Calculated Field.
First, navigate to the Form Fields tab in the App Settings of the Contatcs App. Click the Add Field button.
Next, select a Field Type. We want the Calculated Field to calculate the elapsed time since the last communication with a Contact, so choose the Date Time Field Type.
Next, name the Calculated Field (Last Communication is simple and concise) and select what Section of the Contacts App the Calculated Field will be displayed in (the choices will depend on your setup).
Next, click the Show Advanced Settings box and change the Calculated field to Yes.
Now, select a Calculation Type. Since this is a Date Time Field Type, we have to choose Dynamic for our Calculation Type.
Next, select a Function. Since this is a Date Time Field Type and we want to know the time that has elapsed since the most recent communication, select Max from the dropdown menu.
Lastly, select the Activities that will provide data for the Calculated Field from the dropdown menu of the Related Apps field (Phone Calls, Emails, and Texts are common communication-related Activity Apps).
Save the Calculated Field.
Calculated Field example: Number of Interactions
Let’s create a Calculated Field called Number of Interactions.
Question 1- What do I want the Calculated Field to do?
Answer- Calculate the number of interactions with a Contact (phone calls, emails, and texts).
Question 2- What App should I create the Calculated Field in?
Answer- The Contacts App (or whatever App is used to store customer records)
Question 3- What fields in that App will provide data for the calculation?
Answer- None. This field will draw data from Activity Apps.
Question 4- What Activities (Tasks, Emails, Phone Calls) will provide data for the calculation?
Answer- Phone Calls, Emails, Faxes, Meetings, and Texts.
With these questions answered, we can begin to create the Calculated Field.
First, navigate to the Form Fields tab in the App Settings of the Contacts App. Click the Add Field button.
Next, select a Field Type. We want the Calculated Field to calculate the number of interactions with a Contact, so choose the Number Field Type.
Next, name the Calculated Field (Number of Interactions is simple and concise) and select what Section of the Contacts App the Calculated Field will be displayed in (the choices will depend on your setup).
Next, click the Show Advanced Settings box and change the Calculated field to Yes.
Now, select a Calculation Type. Since this is a Number Field Type, we have to choose Dynamic for our Calculation Type.
Next, select a Function. Since this is a Number Field Type, select Count from the dropdown menu.
Lastly, select the Activities that will provide data for the Calculated Field from the dropdown menu of the Related Apps field (Phone Calls, Emails, Faxes, Meetings, and Texts are common interaction-related Activity Apps).
Save the Calculated Field.
Calculated Field example: Total Cost After Discount
Let’s create a Calculated Field called Total Cost After Discount.
Question 1- What do I want the Calculated Field to do?
Answer- Calculate the total cost of a quote after a discount has been applied.
Question 2- What App should I create the Calculated Field in?
Answer- The Quotes App (or whatever App is used to store purchase records)
Question 3- What fields in that App will provide data for the calculation?
Answer- The Quote Total field (or whatever field contains the value of the quote) and the Discount Total field (or whatever field contains the value of the discount).
Question 4- What Activities (Tasks, Emails, Phone Calls) will provide data for the calculation?
Answer- None. This Calculated Field will use the App fields mentioned in Answer 3.
With these questions answered, we can begin to create the Calculated Field.
First, navigate to the Form Fields tab in the App Settings of the Quotes App. Click the Add Field button.
Next, select a Field Type. We want the Calculated Field to calculate the total cost of a product after service fees in US dollars, so choose the Currency Field Type.
Next, name the Calculated Field (Total Cost After Discount is simple and concise) and select what Section of the Quotes App the Calculated Field will be displayed in (the choices will depend on your setup).
Next, click the Show Advanced Settings box and change the Calculated field to Yes.
Now, select a Calculation Type. Since we want the Calculated Field to perform an equation, choose Formula for the Calculation Type.
Enter the equation into the Formula field. In this case, the equation is:
Price + Service Fee
Save the Calculated Field.
More Calculated Field examples
The following examples are our most common Calculated Fields requests: