Rollup Summary Setup

Prerequisites

  • To set up rollup summary fields, you need:

    • Minimum permissions for the FieldFX modules you are using

    • System permissions:

      • API Enabled

      • Author Apex

      • Customize Application

      • View Setup and Configuration

  • To use rollup summary fields in FieldFX Mobile, you must use one of the following release channels:

    • Sync V4 Beta

    • Sync V4

    • V4 Quarterly Beta

    • V4 Quarterly

Basics

Rollup summary fields display calculated values from related records.

Use a rollup summary field to display the number of tickets on a job.

There are four types of rollup summary:

Type Description

COUNT

Totals the number of records

SUM

Totals the values in a number, currency, or percent field

MIN

Displays the lowest value in a number, currency, percent, date, or date/time field

MAX

Displays the highest value in a number, currency, percent, date, or date/time field

When you add a rollup summary, you must:

  • Add the field to layouts

  • Grant field permissions

  • Add the field to the FX_Mobile_Rollups file

Considerations

Rollup summary fields in FieldFX Back Office calculate values by analyzing all records.

Rollup summary fields in FieldFX Mobile calculate values by analyzing syncable records.

The value in a rollup summary in FieldFX Back Office may differ from the value in the same field in FieldFX Mobile.

Rollup Summary Fields

Adding a COUNT Rollup Summary

This guide explains how to add a COUNT rollup summary field to the Ticket object.

This rollup summary displays the total number of ticket items on a ticket.

  1. Add a Number of Items rollup summary to the Ticket object:

    1. Access FieldFX Back Office

    2. Switch to Salesforce Classic

    3. From Setup, enter "object" in the Quick Find box, then select Objects

    4. Click Ticket

    5. Under Custom Fields & Relationships, click New

    6. Select Rollup Summary

    7. Click Next

    8. In Field Label, enter "Number of Items"

    9. Click Next

    10. In Summarized Object, select "Ticket Items"

    11. Under Select Rollup Type, select COUNT

    12. Click Next

    13. Click Visible twice

    14. Click Next

    15. Select the page layouts on which to include the field

    16. Click Save

  2. Grant permissions for the Number of Items field

  3. Add an FX_Mobile_Rollups static resource:

    1. Open a text editor

    2. Enter the following on the first two lines:

      [
      {
    3. Enter the type of rollup summary you are adding:

      [
        {
          "summaryOperation":"count",
    4. Enter the master-detail relationship for the rollup summary field:

      [
        {
          "summaryOperation":"count",
          "summaryForeignKey":"FX5__Ticket_Item__c.FX5__Ticket__c",
    5. Specify that the rollup summary doesn’t analyze data from a specific field:

      [
        {
          "summaryOperation":"count",
          "summaryForeignKey":"FX5__Ticket_Item__c.FX5__Ticket__c",
          "summarizedField":null,
    6. Enter the object on which you added the rollup summary:

      [
        {
          "summaryOperation":"count",
          "summaryForeignKey":"FX5__Ticket_Item__c.FX5__Ticket__c",
          "summarizedField":null,
          "sObjType":"FX5__Ticket__c",
    7. Enter the API name of the rollup summary:

      [
        {
          "summaryOperation":"count",
          "summaryForeignKey":"FX5__Ticket_Item__c.FX5__Ticket__c",
          "summarizedField":null,
          "sObjType":"FX5__Ticket__c",
          "fieldName":"Number_of_Items__c"
    8. Enter the following on the last two lines:

      [
        {
          "summaryOperation":"count",
          "summaryForeignKey":"FX5__Ticket_Item__c.FX5__Ticket__c",
          "summarizedField":null,
          "sObjType":"FX5__Ticket__c",
          "fieldName":"Number_of_Items__c"
        }
      ]
      • Every left brace { should have a matching right brace }.

      • Enter }, to separate entries for multiple rollup summary fields and always enter } after the last entry in the file.

    9. Save the file with "FX_Mobile_Rollups" as the file name.

  4. Upload the FX_Mobile_Rollups file to FieldFX Back Office:

    1. Access FieldFX Back Office

    2. Switch to Salesforce Classic

    3. From Setup, enter "static" in the Quick Find box, then select Static Resources

    4. Click New

    5. In Name, enter "FX_Mobile_Rollups"

    6. In Cache Control, select "Public"

    7. Click Choose File

    8. Select the FX_Mobile_Rollups file

    9. Click Save.

      When you upload an FX_Mobile_Rollups file, the settings in the file replace any existing settings.

  5. Get all FieldFX Mobile users to sync

Adding a SUM Rollup Summary

This guide explains how to add a SUM rollup summary field to the Ticket object.

This rollup summary displays the total cost of ticket items on a ticket.

  1. Add a Cost of Items rollup summary to the Ticket object:

    1. Access FieldFX Back Office

    2. Switch to Salesforce Classic

    3. From Setup, enter "object" in the Quick Find box, then select Objects

    4. Click Ticket

    5. Under Custom Fields & Relationships, click New

    6. Select Rollup Summary

    7. Click Next

    8. In Field Label, enter "Cost of Items"

    9. Click Next

    10. In Summarized Object, select "Ticket Items"

    11. Under Select Rollup Type, select SUM

    12. In Field to Aggregate, select "Cost"

    13. Click Next

    14. Click Visible twice

    15. Click Next

    16. Select the page layouts on which to include the field

    17. Click Save

  2. Grant permissions for the Cost of Items field

  3. Add an FX_Mobile_Rollups static resource:

    1. Open a text editor

    2. Enter the following on the first two lines:

      [
        {
    3. Enter the type of rollup summary you are adding:

      [
        {
          "summaryOperation":"sum",
    4. Enter the master-detail relationship for the rollup summary field:

      [
        {
          "summaryOperation":"sum",
          "summaryForeignKey":"FX5__Ticket_Item__c.FX5__Ticket__c",
    5. Enter the field for which to total values:

      [
        {
          "summaryOperation":"sum",
          "summaryForeignKey":"FX5__Ticket_Item__c.FX5__Ticket__c",
          "summarizedField":"FX5__Ticket_Item__c.FX5__Cost__c",
    6. Enter the object on which you added the rollup summary:

      [
        {
          "summaryOperation":"sum",
          "summaryForeignKey":"FX5__Ticket_Item__c.FX5__Ticket__c",
          "summarizedField":"FX5__Ticket_Item__c.FX5__Cost__c",
          "sObjType":"FX5__Ticket__c",
    7. Enter the API name of the rollup summary:

      [
        {
          "summaryOperation":"sum",
          "summaryForeignKey":"FX5__Ticket_Item__c.FX5__Ticket__c",
          "summarizedField":"FX5__Ticket_Item__c.FX5__Cost__c",
          "sObjType":"FX5__Ticket__c",
          "fieldName":"Cost_of_Items__c"
    8. Enter the following on the last two lines:

      [
        {
          "summaryOperation":"sum",
          "summaryForeignKey":"FX5__Ticket_Item__c.FX5__Ticket__c",
          "summarizedField":"FX5__Ticket_Item__c.FX5__Cost__c",
          "sObjType":"FX5__Ticket__c",
          "fieldName":"Cost_of_Items__c"
        }
      ]
      • Every left brace { should have a matching right brace }.

      • Enter }, to separate entries for multiple rollup summary fields and always enter } after the last entry in the file.

    9. Save the file with "FX_Mobile_Rollups" as the file name.

  4. Upload the FX_Mobile_Rollups file to FieldFX Back Office:

    1. Access FieldFX Back Office

    2. Switch to Salesforce Classic

    3. From Setup, enter "static" in the Quick Find box, then select Static Resources

    4. Click New

    5. In Name, enter "FX_Mobile_Rollups"

    6. In Cache Control, select "Public"

    7. Click Choose File

    8. Select the FX_Mobile_Rollups file

    9. Click Save

      When you upload an FX_Mobile_Rollups file, the settings in the file replace any existing settings.

  5. Get all FieldFX Mobile users to sync.

Adding a MIN Rollup Summary

This guide explains how to add a MIN rollup summary field to the Quote object.

This rollup summary displays the lowest price of a quote item on a quote.

  1. Add a Lowest Price rollup summary to the Quote object:

    1. Access FieldFX Back Office

    2. Switch to Salesforce Classic

    3. From Setup, enter "object" in the Quick Find box, then select Objects

    4. Click Quote

    5. Under Custom Fields & Relationships, click New

    6. Select Rollup Summary

    7. Click Next

    8. In Field Label, enter "Lowest Price"

    9. Click Next

    10. In Summarized Object, select "Quote Items"

    11. Under Select Rollup Type, select MIN

    12. In Field to Aggregate, select "Extended Amount"

    13. Click Next

    14. Click Visible twice

    15. Click Next

    16. Select the page layouts on which to include the field

    17. Click Save

  2. Grant permissions for the Lowest Price field.

  3. Add an FX_Mobile_Rollups static resource:

    1. Open a text editor

    2. Enter the following on the first two lines:

      [
        {
    3. Enter the type of rollup summary you are adding:

      [
        {
          "summaryOperation":"min",
    4. Enter the master-detail relationship for the rollup summary field:

      [
        {
          "summaryOperation":"min",
          "summaryForeignKey":"FX5__Quote_Item__c.FX5__Quote__c",
    5. Enter the field for which to total values:

      [
        {
          "summaryOperation":"min",
          "summaryForeignKey":"FX5__Quote_Item__c.FX5__Quote__c",
          "summarizedField":"FX5__Quote_Item__c.FX5__Extended_Amount__c",
    6. Enter the object on which you added the rollup summary:

      [
        {
          "summaryOperation":"min",
          "summaryForeignKey":"FX5__Quote_Item__c.FX5__Quote__c",
          "summarizedField":"FX5__Quote_Item__c.FX5__Extended_Amount__c",
          "sObjType":"FX5__Quote__c",
    7. Enter the API name of the rollup summary:

      [
        {
          "summaryOperation":"min",
          "summaryForeignKey":"FX5__Quote_Item__c.FX5__Quote__c",
          "summarizedField":"FX5__Quote_Item__c.FX5__Extended_Amount__c",
          "sObjType":"FX5__Quote__c",
          "fieldName":"Lowest_Price__c"
    8. Enter the following on the last two lines:

      [
        {
          "summaryOperation":"min",
          "summaryForeignKey":"FX5__Quote_Item__c.FX5__Quote__c",
          "summarizedField":"FX5__Quote_Item__c.FX5__Extended_Amount__c",
          "sObjType":"FX5__Quote__c",
          "fieldName":"Lowest_Price__c"
        }
      ]
      • Every left brace { should have a matching right brace }.

      • Enter }, to separate entries for multiple rollup summary fields and always enter } after the last entry in the file.

    9. Save the file with "FX_Mobile_Rollups" as the file name.

  4. Upload the FX_Mobile_Rollups file to FieldFX Back Office:

    1. Access FieldFX Back Office

    2. Switch to Salesforce Classic

    3. From Setup, enter "static" in the Quick Find box, then select Static Resources

    4. Click New

    5. In Name, enter "FX_Mobile_Rollups"

    6. In Cache Control, select "Public"

    7. Click Choose File

    8. Select the FX_Mobile_Rollups file

    9. Click Save

      When you upload an FX_Mobile_Rollups file, the settings in the file replace any existing settings.

  5. Get all FieldFX Mobile users to sync

Adding a MAX Rollup Summary

This guide explains how to add a MAX rollup summary field to the Quote object.

This rollup summary displays the highest price of a quote item on a quote.

  1. Add a Highest Price rollup summary to the Quote object:

    1. Access FieldFX Back Office

    2. Switch to Salesforce Classic

    3. From Setup, enter "object" in the Quick Find box, then select Objects

    4. Click Quote

    5. Under Custom Fields & Relationships, click New

    6. Select Rollup Summary

    7. Click Next

    8. In Field Label, enter "Highest Price"

    9. Click Next

    10. In Summarized Object, select "Quote Items"

    11. Under Select Rollup Type, select MAX

    12. In Field to Aggregate, select "Extended Amount"

    13. Click Next

    14. Click Visible twice

    15. Click Next

    16. Select the page layouts on which to include the field

    17. Click Save

  2. Grant permissions for the Highest Price field.

  3. Add an FX_Mobile_Rollups static resource:

    1. Open a text editor

    2. Enter the following on the first two lines:

      [
        {
    3. Enter the type of rollup summary you are adding:

      [
        {
          "summaryOperation":"max",
    4. Enter the master-detail relationship for the rollup summary field:

      [
        {
          "summaryOperation":"max",
          "summaryForeignKey":"FX5__Quote_Item__c.FX5__Quote__c",
    5. Enter the field for which to total values:

      [
        {
          "summaryOperation":"max",
          "summaryForeignKey":"FX5__Quote_Item__c.FX5__Quote__c",
          "summarizedField":"FX5__Quote_Item__c.FX5__Extended_Amount__c",
    6. Enter the object on which you added the rollup summary:

      [
        {
          "summaryOperation":"max",
          "summaryForeignKey":"FX5__Quote_Item__c.FX5__Quote__c",
          "summarizedField":"FX5__Quote_Item__c.FX5__Extended_Amount__c",
          "sObjType":"FX5__Quote__c",
    7. Enter the API name of the rollup summary:

      [
        {
          "summaryOperation":"max",
          "summaryForeignKey":"FX5__Quote_Item__c.FX5__Quote__c",
          "summarizedField":"FX5__Quote_Item__c.FX5__Extended_Amount__c",
          "sObjType":"FX5__Quote__c",
          "fieldName":"Highest_Price__c"
    8. Enter the following on the last two lines:

      [
        {
          "summaryOperation":"max",
          "summaryForeignKey":"FX5__Quote_Item__c.FX5__Quote__c",
          "summarizedField":"FX5__Quote_Item__c.FX5__Extended_Amount__c",
          "sObjType":"FX5__Quote__c",
          "fieldName":"Highest_Price__c"
        }
      ]
      • Every left brace { should have a matching right brace }.

      • Enter }, to separate entries for multiple rollup summary fields and always enter } after the last entry in the file.

    9. Save the file with FX_Mobile_Rollups as the file name.

  4. Upload the FX_Mobile_Rollups file to FieldFX Back Office:

    1. Access FieldFX Back Office

    2. Switch to Salesforce Classic

    3. From Setup, enter "static" in the Quick Find box, then select Static Resources

    4. Click New

    5. In Name, enter "FX_Mobile_Rollups"

    6. In Cache Control, select "Public"

    7. Click Choose File

    8. Select the FX_Mobile_Rollups file

    9. Click Save

      When you upload an FX_Mobile_Rollups file, the settings in the file replace any existing settings.

  5. Get all FieldFX Mobile users to sync

Filters

Basics

Filters control the records analyzed in rollup summary calculations.

Use filters if you want rollups to display data for specific record types or for records matching specific criteria.

FieldFX supports the use of the following operators within filters:

  • equals

  • notEqual

  • lessThan

  • greaterThan

  • lessOrEqual

  • greaterOrEqual

  • contains

  • notContain

  • startsWith

  • includes

  • excludes

FieldFX does not support the within operator.
Refer to the Filter Operators Reference article for more information about the supported operators.

Examples

The following examples present how to use a few of the supported operators.

Use the common syntax elements in these examples to learn to write custom filters that best support your organization.

Automatically Added Quote Items

This filter excludes quote items added to a quote automatically.

{
  "field": "FX5__Quote_Item__c.FX5__Auto_Added__c",
  "operation": "equals",
  "value": false
}

Field Value

This filter excludes ticket items with an Input Qty of 3 or less.

{
  "field": "FX5_Ticket_Item__c.FX5__Input_Qty__c",
  "operation": "greaterThan",
  "value": 3
}

Items Not on Standby

This filter excludes ticket items that have On Standby selected.

{
  "field": "FX5__Ticket_Item__c.FX5__On_Standby__c",
  "operation": "equals",
  "value": false
}

Record Type

This filter excludes quote items that don’t have the Labor record type.

{
  "field": "FX5__Quote_Item__c.RecordTypeId",
  "operation": "equals",
  "value": "012F0000000oOOlIAM"
}
  • 012F0000000oOOlIAM is the 18-digit case insensitive ID for the Labor record type.

  • You must use the 18-digit case insensitive ID to represent a record type in a filter.

  • Don’t use the 15-digit case sensitive ID or the record type name to represent a record type in a filter.

Multiple Criteria

This filter excludes tickets that aren’t for the Broussard office and don’t have the Offshore checkbox selected.

{
  "field": "FX5__Ticket__c.FX5__Office__c",
  "operation": "equals",
  "value": "Broussard"
},

{
  "field": "FX5__Ticket__c.Offshore__c",
  "operation": "equals",
  "value": false
}
  • This filter excludes tickets that don’t match two specific values (AND statement).

  • Add a comma to separate criteria but don’t add a comma after the last criterion.

Adding a Filter to a Rollup Summary

This guide explains how to add a filter to exclude ticket items from a rollup summary calculation that don’t have the Labor record type.

  1. Add the filter to the rollup summary field:

    1. Access FieldFX Back Office.

    2. Switch to Salesforce Classic

    3. From Setup, enter "object" in the Quick Find box, then select Objects

    4. Click Ticket

    5. Under Custom Fields & Relationships, click the name of the rollup summary

    6. Click Edit

    7. Under Filter Criteria, select Only records meeting certain criteria should be included in the calculation

    8. Enter the following criteria:

      • Field: Record Type

      • Operator: equals

      • Value: True

    9. Click Save

  2. Add the filter to the FX_Mobile_Rollups static resource:

    1. Open the FX_Mobile_Rollups file in a text editor

    2. Locate the entry for the rollup summary

      [
        {
          "summaryOperation":"sum",
          "summaryForeignKey":"FX5__Ticket_Item__c.FX5__Ticket__c",
          "summarizedField":"FX5__Ticket_Item__c.FX5__Cost__c",
          "sObjType":"FX5__Ticket__c",
          "fieldName":"Cost_of_Items__c"
        }
      ]
    3. Add the following code to filter the rollup summary by the Labor record type:

      [
        {
          "summaryOperation":"sum",
          "summaryForeignKey":"FX5__Ticket_Item__c.FX5__Ticket__c",
          "summarizedField":"FX5__Ticket_Item__c.FX5__Cost__c",
          "sObjType":"FX5__Ticket__c",
          "fieldName":"Cost_of_Items__c",
          "summaryFilterItems":
          [
            {
              "field": "FX5__Ticket_Item__c.RecordTypeId",
              "operation": "equals",
              "value": "012F0000000oOOlIAM"
            }
          ]
        }
      ]
      • 012F0000000oOOlIAM is the 18-digit case insensitive ID for the Labor record type.

      • You must use the 18-digit case insensitive ID to represent a record type in a filter.

      • Don’t use the 15-digit case sensitive ID or the record type name to represent a record type in a filter.

    4. Save the file with FX_Mobile_Rollups as the file name.

  3. Upload the FX_Mobile_Rollups file to FieldFX Back Office:

    1. Access FieldFX Back Office

    2. Switch to Salesforce Classic

    3. From Setup, enter "static" in the Quick Find box, then select Static Resources

    4. Click New

    5. In Name, enter "FX_Mobile_Rollups"

    6. In Cache Control, select "Public"

    7. Click Choose File

    8. Select the FX_Mobile_Rollups file

      When you upload an FX_Mobile_Rollups file, the settings in the file replace any existing settings.

    9. Click Save

  4. Get all FieldFX Mobile users to sync

Rollup Summary Builder

Basics

You must set up rollup summary fields in FieldFX Back Office and FieldFX Mobile separately.

The Rollup Summary Builder makes it easier to add rollups that work systemwide.

How It Works

When you run the Rollup Summary Builder, it:

  • Analyzes FieldFX Back Office to look for rollup summary fields.

  • Creates a new FX5__Mobile_Rollups static resource containing every rollup summary in FieldFX Back Office.

  • Creates a backup copy of the current FX5__Mobile_Rollups file for your org.

  • Replaces the existing FX5Mobile_Rollups file with the new FX5Mobile_Rollups file.

  • Uploads the backup copy of the previous FX5__Mobile_Rollups file to the static resource list for your org.

Once the Rollup Summary Builder uploads a new FX5_Mobile_Rollups file, the rollups listed in the file work systemwide.

Setting Up the Rollup Summary Builder

  1. Access FieldFX Back Office

  2. Switch to Salesforce Classic

  3. From Setup, enter "remote" in the Quick Find box, then select Remote Site Settings

  4. Click New Remote Site

  5. In Remote Site Name, enter SFDCToolingAPI

  6. In Remote Site URL, enter the domain in which your org runs

    To get the URL for your domain, copy the first part of the URL from the address bar in your browser:

    For example, https://na43.salesforce.com

    The Remote Site URL field is case-sensitive.Make sure the URL you enter uses the correct capitalization.
  7. Click Active

  8. Click Save

  9. Complete one of the following:

Scheduling the Rollup Summary Builder to Run Automatically

  1. Access FieldFX Back Office

  2. Switch to Salesforce Classic

  3. From Setup, enter "apex" in the Quick Find box, then select Apex Classes

  4. Click Schedule Apex

  5. In Job Name, enter "Rollup Summary Builder"

  6. In Apex Class, select "RollupInfoHandler"

  7. Select how often you want the Rollup Summary Builder to run

    Select a frequency of at least once per week.
  8. Click Save

Running the Rollup Summary Builder Manually

  1. Access FieldFX Back Office

  2. Access Workbench

  3. Select Utilities | Apex Execute

  4. Enter the following script:

    System.debug(FX5.FXWorkerLauncher.DoWork('FX5.RollupInfoHandler', null));
  5. Click Execute

    The Rollup Summary Builder:

    • Analyzes FieldFX Back Office to look for rollup summary fields.

    • Creates a new FX5__Mobile_Rollups static resource containing every rollup summary in FieldFX Back Office.

    • Creates a backup copy of the current FX5__Mobile_Rollups file for your org.

    • Replaces the existing FX5Mobile_Rollups file with the new FX5Mobile_Rollups file.

    • Uploads the backup copy of the previous FX5__Mobile_Rollups file to the static resource list for your org.

Sample FX_Mobile_Rollups File