Blog

Roll-up summary fields are a very useful Salesforce feature, but you may come across a situation where you need to rollup the value of a formula field. Here is an example: You have added a custom field to the Product object to record the cost of a product. You want the total cost of all products added displayed on an opportunity. In the screenshot below you can see Widget A has a cost of $50.

When we add a product to an opportunity, we want the product cost displayed. So we add it to the related list.

There is a solution, however it may not apply to all situations. To be able to rollup the value of the cost field, we need to copy it to a custom currency field on the opportunity product record. Then we can use that field for the rollup summary.

Now with the three widget products added to the opportunity, the opportunity value is automatically calculated and displayed in the opportunity value field.

So, we now create a roll-up summary field and try to add our Product Cost field. However, as the formula field is referring to a field in another object (e.g. cross object reference), it is not available for use.

There is a solution, but it will only apply in certain situations. To be able to rollup the product cost field, we need to copy the value from the formula field to a custom currency field on the opportunity product object. We can then use that field for the rollup summary. To do the copy we use a workflow rule and field update.

First we create the custom currency field on the opportunity product object.

Next we create the workflow rule and field update.

So for testing purposes, we add the new field to the related list.

At this point, there is no value in our new field, as the workflow rule did not exist when we added the products. To get the value populated, we need to remove the products and add them again. Now the workflow rule runs when we add the product and you can see below that the field has been populated.

Now we can go back to adding the roll-up summary field. Our custom field is available to select.

And finally, here is the sum of the product cost on the Opportunity Layout.

Now as mentioned earlier, this solution may not work for all situations. The reason being, that the value of the formula field is copied when the opportunity product record is created or edited. That means, for example if the product cost is updated after the product is added to the opportunity, the formula field will show the updated value, but the custom field that we added for use in the rollup summary will not.

That would be preferable in our case, as we would want the cost of the product when it was added to be recorded on the opportunity and used for the rollup. If the cost was updated months later, we wouldn't want that change reflected on our previous opportunities and this is a simple solution that doesn't need code and uses standard Salesforce workflow. There maybe other cases where the current value is always required, or required for any open opportunities. In that case, you would need a trigger to update the opportunity product record when a change is made to the object that the formula sources its value from.

What Certification are you studying for now?

Focus on Force currently provides practice exams and study guides for sixteen certifications.

Salesforce Roll-up Summary Using the Value of a Formula Field

Roll-up summary fields are a very useful Salesforce feature, but you may come across a situation where you need to rollup the value of a formula field. Here is an example: You have added a custom field to the Product object to record the cost of a product. You want the total cost of all products added displayed on an opportunity. In the screenshot below you can see Widget A… Read More

Salesforce Roll-up Summary Using the Value of a Formula Field

Saving Emails to Salesforce

If you use Gmail or another web based email service, Salesforce has a feature that will allow you to save your emails related to leads, contacts and open opportunities. It is the ‘Email to Salesforce’ features and when enabled, allows users to bcc a unique bcc email address to automatically create activity records against records in Salesforce. To use this feature, firstly the Salesforce Administrator has to enabled it, and… Read More

Saving Emails to Salesforce

Comparing Salesforce Editions

There are a number of editions of Salesforce offering varying features and capabilities. If you are new to Salesforce and deciding which edition is right for you, then this guide will be helpful. If you already have Salesforce it will be useful to know what features you can take advantage of and any limitations you will have. It is of course possible to upgrade to a higher edition. If you… Read More

Comparing Salesforce Editions

Salesforce Search Layouts

Salesforce gives up the ability to customize many areas of how it displays data. One area that is important to understand but easy to overlook is search layouts. Search layouts allow us to customize the fields both standard and custom that are displayed in various results lists. It is worth the time to customize, as it can improve productivity by ensuring that the most useful fields are displayed in the… Read More

Salesforce Search Layouts

Salesforce Instances vs Orgs vs Environments

Once you start getting involved with Salesforce, you will hear a number of terms such as Instance, Org, Environment and even POD. Its easy to get these confused or even not to even be aware of what they really mean. One person may refer to the development instance and another the development environment. Some organisations may refer to the fact that they have multiple instances of Salesforce, and another multiple… Read More

Salesforce Instances vs Orgs vs Environments

What is the Salesforce Account Hierarchy (And How To Use it)

The Salesforce account hierarchy allow accounts to be related in a hierarchy by using a ‘parent account’ field to link them together. Once linked, the complete hierarchy structure can be viewed and links are provided to navigate directly to the accounts.The first step is to create or identify the ultimate ‘Parent’ account. This is the account at the top of the hierarchy. In our example, the top level account is… Read More

What is the Salesforce Account Hierarchy (And How To Use it)

Data Loader Tips – Inserting or Updating Blank Values in a Field

You may have come across the situation where you need to use Dataloader to clear or delete the value of a field. Normally, if you provide a blank value in the input file, DataLoader will ignore it and leave the field value as is. Lets look at an example. Here we have loaded data into the Product Description field instead of the Product Code field. Lets imagine, instead of 3… Read More

Data Loader Tips – Inserting or Updating Blank Values in a Field

Salesforce Multicurrency – What You Need to Know

      What is Salesforce multicurrency?Before we look at how multicurrency works and what you need to look out for, lets look at what it offers:Adds the ability to record amounts in different currencies. If you don’t have multicurrency enabled, then amounts are just displayed as an amount.Allows amounts to be converted, displayed and reported according to exchange ratesAllows the use of dated exchange rates so the value at… Read More

Salesforce Multicurrency – What You Need to Know

Preventing Duplicate Records with Salesforce Config

The Salesforce mantra is ‘clicks not code’ so we always look for a config solution to a problem before resorting to code. While we can set the unique indicator on a custom field to prevent duplicate values for one field across records, how do we prevent records inserted with duplicate values across all or some of the fields? Do we need to write a trigger to handle this? Or is… Read More

Preventing Duplicate Records with Salesforce Config

Salesforce Case Management

In most every company which prides itself on taking care of its customer base to the fullest, the Salesforce native functionality of Case Management goes hand in hand with customer success. The departments in an organization that deal with customer service, product support, issue resolution and service requests can all benefit from utilizing the case management functionalities; and related automation options; within Salesforce. As described in Salesforce Service Cloud Overview … Read More

Salesforce Case Management

Using DataLoader with Lookup Fields

External Ids provide a convenient way to integrate data from an external system, by allowing the use of a unique record identifer for records instead of the Salesforce Id. For example, you may define an Account Code external id on the Account object, which is the unique key for an account record in an ERP system that is integrated with Salesforce. When using DataLoader or another integration tool to update… Read More

Using DataLoader with Lookup Fields

Salesforce Mass Email

When you hear that Salesforce has a mass email capability you may think that you don’t need a marketing automation package to do that for you. Dig a little deeper and you will find that although Salesforce can send mass emails, there are a number of limitations that may have you looking back at AppExchange products. Firstly, lets look at what you can do with Salesforce mass email capability. You… Read More

Salesforce Mass Email

Quick Start Guide to using Conga Composer with Excel

Conga Composer is one of the most widely used 3rd party AppExchange apps for document generation with Salesforce. It can be used to merge Salesforce data to produce documents in Word, Excel, Powerpoint, HTML Email and PDF format. Here is a quick guide to generating an Excel spreadsheet with data from Salesforce. Create Your Excel Template Define the Fields and Reports it will use Add Merge Fields to the Excel… Read More

Quick Start Guide to using Conga Composer with Excel

How to Delete Multiple Records from a Salesforce Related List

You may be faced with the situation where you need to be able to delete multiple records from a related list in one click. Standard related lists do not have a feature to select all and delete all selected records. The standard way to delete from a related list is to use the del link and delete each record individually. This can be very time consuming and tiresome if there… Read More

How to Delete Multiple Records from a Salesforce Related List