Salesforce.com Roll-up Summary Fields

Perhaps you've run into a limitation with the Salesforce.com Rollup Summary field functionality. While this is an incredibly useful function, roll up summary fields can only be used in very specific architectures.  You must come up with some other way to replace the functionality of a roll up summary field when you don't have the prerequisite architecture or other needs of the system can't permit that architecture. I'll show you below how to get around the limitations.

You should use a rollup summary field when you have a set of child records to a parent record and you want to total some value from those child records.

Roll-up Summary Limitations


Here are a few of the limitations of a roll-up summary field (there are probably others):
- you must be in a master-detail relationship in order to use them
- the field being rolled up cannot be a formula field.
- you can only put 10 roll-up summary fields on an object

So what do you do when you can't comply with one of the above?

Write a trigger!

A trigger can conveniently overcome all of the limitations identified above. (with the one complicating factor being that you can only write a trigger in Enterprise/Platform/Unlimited editions of Salesforce.com)

To replace the rollup summary functionality, put the trigger on the child object and have it fire whenever a record of that object type is saved. When the trigger is executed, it should collect the value that is to be totaled from the originating record, then go up to the parent object (which now does not need to be in a master-detail relationship), and collect that same value from every other child record. Do the math, then place the result in a custom field on the parent record.

An Example


So for example, imagine a company that uses a Unit custom object (kind of like Products) against their Opportunities to list what clients are buying. They have a Vendor Order record (custom object) also where they order those units from their vendor. The Unit object is child to the Vendor Order object also. So the Unit is the child in a master detail relationship to the Opportunity but in a lookup relationship to the Vendor Order. Unit can't be in a master-detail relationship with Vendor Order because the Vendor Order record doesn't exist when the Units are added to the Opportunity. In master detail relationship, parents must exist before children.

If the unit record contains a Price to the customer, that can be conveniently totaled on the Opportunity using a roll-up summary field. The unit will also have a Vendor Price to record what it costs to buy the unit from the vendor. But a rollup summary field isn't available on the Vendor Order because it isn't in a Master-Detail relationship. So the Vendor Order total price isn't possible via rollup summary field.

By placing a trigger on the Unit object however, we can get our total. That trigger can execute each time the Unit record is saved, then take the Vendor Price from that Unit record, get the Vendor Price from every other Unit record associated with that Vendor Order, do the math, then save that value in the Vendor Order, Vendor Order Total Price field.


Get Help from Snapptraffic Consulting

Obviously, the challenge a typical salesforce.com customer faces is getting the trigger written. You'll need a development environment and someone who knows how to write in APEX. If you don't have those resources available to you. Feel free to contact us, we'd be glad to help. A trigger like the one noted about takes us about 3 hours to produce. (You can find our current rates on our website, noted below). Generally we can have it written within a day or two of your request.

You can reach us at www.snapptraffic.com - we'd be glad to listen to any issues you face and help you to get them solved.

Salesforce Web2Anything

Salesforce.com was kind enough to provide a very simple system for Web-2-Lead (or Web-To-Lead - whatever you prefer to call it). They also have a system for web2case. These are great if you need a really simple method for adding a form to your website which allows you to pass details from forms on your website directly into salesforce.com leads or cases.

But what do you do if you want to do web2opportunity, or web2contact, or web2custom object. There are a few third party form providers which may be able to assist, but what I find works best is a salesforce.com sites page.

Salesforce.com Sites Pages

A sites page is a web page, hosted by salesforce.com (or force.com more precisely) that interacts with your salesforce.com instance. You can use it to display information contained in your salesforce.com data base (the classic example, used by salesforce.com frequently, being a list of job openings at your company for which you want to allow people to apply).

The domain of one of your sites pages would be yourcompany.force.com/yourpagename. You can get one domain, but as many pages as you need.

Showing Salesforce.com Data on the Web

The idea here is that you use a sites page to show salesforce.com data to third parties. Another approach that I've used recently is to make customer quotes from an opportunity available to prospects via a sites page - this  technique allows your users to send an e-mail with a link to their quote rather than by setting the quote itself.  The quote is simply presented on the salesforce.com sites page - the system finds the correct quote by details contained in the link.

Receiving Data from a form into Salesforce.com

But what about when you want to gather information FROM an individual? We can use Salesforce.com Sites there as well. We've done dozens of variations of this, but one interesting application permitted our clients to gather information from the client in preparation for sending a proposal. In that situation, an opportunity was already created, then at an early stage in the process, an email goes out to the client (automatically sent by a salesforce.com workflow rule). That email asks the client to click a link so that they can answer some questions online so that their rep can complete their proposal. The prospect fills out the form, which then submits against their opportunity in salesforce. The link in the email contained the details necessary to "connect" the prospect to the correct form and then the correct opportunity. Another workflow rule notifies that sales rep that the data has been received.

Salesforce.com Web-To-Anything!

This kind of salesforce.com sites page can be used to gather nearly any kind of data that you care to collect from your prospects and get it into salesforce.com. So essentially, they have provided you with a web-2-anything capability. It isn't quite as convenient as the build in web-2-lead, requiring some development - but it immensely more capable.

If you have a need for a salesforce.com sites page, or any apex or visualforce development, please reach out to us atwww.snapptraffic.com - we'd be glad to discuss your salesforce.com sites or development project, quote it, and get it built for you.