This page is one of our website’s most popular pages because the concept of summarizing product text fields to the Opportunity has real value for Salesforce clients.
So we just decided to build a free mini-application that would allow roll-ups to Opportunity. Here’s a beta version of that skeleton version which has no admin UX outside of using Custom Settings by hand.
Updates will definitely follow!
If you need anything, contact us at email@example.comInstall the Opportunity Product Summarizer in Production
Install the Opportunity Product Summarizer in Sandbox
1) Install the Opportunity Line Item summarizer Application
2) Map the fields in the Custom Settings
3) Activate the App and set the “Run all Opps Thru Trigger”
4) Use Apex Data Loader to update the Legacy Opportunity Products from Opportunities you want summarized (test with 50 first)
5) Change the settings of the application for ongoing use
1) Install the application:
Install for Admins Only
(it’s an automation application that non-admins do not need to access)
2) Map the fields in the Custom Settings:
You can use this application to string out any Opportunity Text field values to any Opportunity Text field (and future enhancements will expand capabilities and the admin UX).
Today, you could use the Custom Settings “Magic Robot OLI: Line to Parent Mapping” to specify how you want it to work:
A short text field can be used in report criteria. A long text field cannot.
Specifically to represent what you have, we would “Manage” / Create two “Magic Robot OLI: Line to Parent Mapping” records that look like this:
3) Activate it and set the “Run all Opps Thru Trigger”
A) In salesforce, go to Setup -> Search for “Custom Settings” -> Click Custom Settings
B) Now click on “Magic Robot OLI App Settings”:
C) Create new Default level settings:
D) Set true (Checked) for:
– Activate Application
– Run all Opps Thru Update? (this setting means that when you update Opportunity Line Items, it will send the values to the opportunity regardless of the ProductCode field changing or not)
Save the Settings.
Once you save, the application will be active so any edits, inserts or deletes of Opportunity Products will mean your Opportunities’ fields will get updated.
4) Use Apex Data Loader to update the Opportunity Products from Opportunities you want summarized (test with 10 or 50 first just to make sure nothing bad happens)
A) Deactivate any workflow rules or process builders on the Opportunity that will email anyone or do any major cross-object updates
B) Export the report of Opportunity Products (Line Items) to CSV. The only column you need is the 18-character id (but you can keep whatever you want.
C) Use Apex Data Loader to run an update on all the Opportunity Products in your spreadsheet:
i) Open Data Loader
ii) choose “Update”
iv) Now select “Show all Salesforce Objects” & “Opportunity Product”
v) select your CSV file of Opportunity Products
vi) Map the Record Id field to the column of the record id in your CSV file (you only need to map the “id” field)
vii) click next & finish
… now Data Loader will be updating the Opportunity Products, which will get caught by the Magic Robot trigger and will update the two fields on your Opportunity with the Product Codes list. Wait for that to finish.
5) Once Data Loader is finished and all your opportunities are set, you should now change the settings to this for ongoing use by your end users:
Checking the box for “Use At-Future to update Opps?” will be a better user experience for your end users in that the processing to update the Opportunities will happen asynchronously. So when they update or create or delete Opportunity Products, the automation to update the Opportunities will happen a few milliseconds later when the system has resources, and if there are any problems updating or other automation is run because the Opportunity is updated, the end users will not be waiting for the page to refresh. However, this also means that the product codes may not be instantaneously on the Opportunity.
Also, any time you make mass updates, you will want this setting OFF because running too many records through that at-future framework (e.g. more than a few hundred) can jam up salesforce’s asynchronous queues.
6) OTHER NOTES ABOUT THE APP:
If there are ever problems with the trigger throwing exceptions for the reps, you can always disable it using the App Settings, like this:
Any time you are going to insert, delete, or update more than 50 Opportunity products, you should disable the setting that tells the App to use an at-future asynchronous update to update the Opportunities’ fields.
To disable that behavior, you would just go back to the app settings, click Manage and then uncheck the box for “Use At-Future to Update Opps?” and save the settings: