Back in Dreamforce 2015, i told the audience in a session dedicated to Custom Metadata that i estimated it would take around 5 days to perform the retro fit from Custom Object to Custom Metadata. Well i’m pleased to say i have come in a little under that, and also retained support for using Custom Object’s to store rollup definitions for now.
“Custom Metadata is like Game of Thrones, its addictive, great value for money and I just keep wanting more of it!”
In this blog i’ll talk about what support for Custom Metadata means for users of the tool and also a bit about how technically the retrofit was coded.
Before getting into the coding side, lets quickly discuss the new feature and what you can expect…
What is so good about Custom Metadata then?
Well if you have not heard by now, its basically a huge time saver for anyone using apps that have adopted it. As the configurations you make are no longer treated as data but a metadata.
What that means is like other configurations you make under the Setup menu, your rollups in this case are treated like any layout, Custom Field, Validation Rule, Flow etc you have also added, when it comes to migrating to production via Change Sets or building out an extension package and packaging rollups. In addition if your refreshing a configuration only Sandbox, your rollups get copied over as well! No more rekeying rollups or using Data Loaders to transfer them.
If you don’t want to take my word for it, take a look at what Aaaron, Platform Product Management Director at Salesforce, has to say!
Install vs Upgrade
If your familiar with the tool but installing for the first time in a new org you’ll notice some changes to the default tabs (as shown above), though worry not, the old tabs are still present. So if you’d rather catchup with this stuff later just continue as normal setting up your rollups via the Lookup Rollup Summaries tab.
If your upgrading things will remain the same and you’ll have to go to All Tabs to find the new tab above. When you select the new tab you will be presented with a small info message, a link to the old tab and a means to dismiss it once read from appearing again in the future.
Tip: You can edit the Declarative Lookup Rollup Summaries app tabs under Setup to remove the new tab and replace with the old until your ready
Why a new Tab and not the native Custom Metadata UI?
The platform provided UI for Custom Metadata is for sure a much appreciated addition, with Layout support its certainly wins out over Custom Settings for sure! In this case however I still found myself wanting in terms of the user experience…
When editing Custom Metadata based rollups I wanted two core peaces of functionality currently available when using the Custom Object based UI. Mainly validation (the existing Apex Trigger / Domain logic) to check field names, allowed activation etc and also make available the various buttons to manage the child object trigger and start/schedule calculations. So, as per the info message above, you can use the native Custom Metadata Types under Setup if you wish, but be advised for now at least, you’ll be bypassing validation.
The design is based on my earlier proof of concept described in this blog.
Does the new tab do all the stuff the old one does?
Almost! Take a look at the Pilot limitations section (see v2.0 release) in the README.
Can i mix and match between using this new feature and existing?
Yes you totally can. Just make sure if you copy over an old rollup to deactivate it once you activate the Custom Metadata based one to avoid duplicate processing.
Is there a means to automate copying my old rollups over to Custom Metadata?
Not currently. This is possible and something i wanted to build for this release, i just ran out of available time, so is now on the backlog as a future enhancement.
I see this is Pilot, are there any known limitations?
Take a look at the Pilot limitations section (see v2.0 release) in the README.
How did you go about coding this retrofit to Custom Metadata?
The Apex Enterprise Patterns and Separation of Concerns most definitely helped me perform the update here. Especially as i wanted to effectively support two storage options, that shared the same fields, but leave the core functionality intact.
If you review the GitHub History around the few days i was working on this (22nd to 24th) you can see more or less that i took the following approach. Also after each set of changes ensuring all unit tests where still working was key.
- Created the Custom Metadata object, as per the approach i took in my original proof of concept, this is mostly a copy paste from the Custom Object with some tweaks.
- Create a Apex wrapper class around the Custom Object and Custom Metadata representation of the rollup definition, RollupSummary class.
- Updated the Selector to return RollupSummary lists instead of Custom Objects. At this stage i just wanted to complete a sweep to address compilation issues (primarily in the Service layer). I had not plumbed in querying for Custom Metadata yet.
- Decoupled tracking the Calculation Job Id from the rollup definition (this after all is operational information) and created a new Custom Object to track this, that both modes would use.
- Updated the Domain class to support both storage options by utilising the RollupSummary wrapper class within its core logic, to retrieve field values and set field errors etc. Thus the Domain class logic has been abstracted away from the underlying storage type. Apex Trigger behaviour is totally unaffected.
- Developed the new UI based on the proof of concept from my earlier blog. Some new RollupService methods also leveraged the CustomMetadataService to perform CRUD operations on Custom Metadata Objects via the Salesforce Metadata API also highlighted in the same blog.
- New Service methods have been added to expose operations to callers such as the new UI controller above. These methods also delegate to the Domain class onValidate methods to ensure the same validation as applied to the Custom Object via its Trigger is reused consistently.
Summary
Custom Metadata is like Game of Thrones, its addictive, great value for money and I just keep wanting more of it!
Pingback: Declarative Lookup Rollup Summary Tool and Custom Metadata | SutoCom Solutions
January 8, 2016 at 8:26 pm
Andy – This is an super powerful tool. I’ve been leveraging it in few instances to do thing roll-up doesn’t accomplish. I however and a non-trained / certified admin / architect and have it a couple of stumbling blocks. First, I sell through a channel and I’m trying to bubble up the NAME of the VAR that last sold to the account. I’m pulling from System_Integrator__c, a field looked up based on name and only able to get the SF Account Number for that name. How can I get the literal? That done, I want to pull the business pending with VAR. Then I can…… There’s a great degree of functionality that your tool delivers, I only wish I was more proficient in SOQL and structure. Thanks either way.
January 9, 2016 at 10:25 am
Hi mark, no worries I can help. What do you mean by literal? We can also continue this conv in the Chatter group, see the link on the readme. Thanks
January 9, 2016 at 2:47 pm
Andy – Reading my comment again, I wasn’t too clear. Sorry. We sell through a channel and on our opportunities, our sales team has to identify the VAR sales rep associated with the deal. Based on the VAR sales rep, I lookup the name of their company- its not a literal entry or perhaps static entry but resolved/looked up value based on the reps name. The product I get leveraging your tool is the SF account id – 001300000017ZbeAAE- not the name. How can I change 001300000017ZbeAAE to VAR 123ABC?
January 9, 2016 at 3:10 pm
Yeah that makes more sense, can you share your rollup detail and info on the fields via chatter screenshot perhaps?
January 9, 2016 at 3:49 pm
done…. thank you very much for the expert advice. very powerful tool, I wish I had the knowledge / skill to take greater advantage of it. thank you
January 22, 2016 at 6:55 pm
Andy – I was working on a roll up and for some reason, it will only work when I create or delete the detail record. When I update the detail record the roll up does not update.
January 22, 2016 at 7:05 pm
You have to list the fields that cause it to trigger, by default it’s a change to the rollup field on the child object. Though through the relationship criteria fields field you can list others
March 7, 2016 at 6:53 pm
Hey Andrew, I just started playing with your awesome declarative lookup rollup tool. Thanks for it. I’m curious will it work with contact roles? If so, I cant seem to figure it out.
March 10, 2016 at 12:38 am
Thanks! Would you please mind asking this question on the Chatter group, see link on the README file.
April 22, 2016 at 3:22 pm
Hey Andrew, I am currently using this to count activities completed at the Account level (tasks activity field rolling up to an account count) and looking to roll it out to the Lead and Oppy objects, but not having success. Is there something I am missing here? I used all of the same settings as I did with account, but think that the Relationship Field value of ‘AccountID’ is why this isn’t working on other objects. Any advice on how to get this working on those other objects?
April 25, 2016 at 11:53 am
You should be using WhatId I believe. According to the docs AccountId is not updated for Lead.
June 13, 2016 at 4:17 pm
I cannot uninstall this App. I get an error that it is used in Apes Classes:
Apex Class RollupService Component is in use by another component in your organization. dlrs_CaseTest
Apex Class RollupService Component is in use by another component in your organization. dlrs_CaseTrigger
June 13, 2016 at 6:01 pm
You need to go to the Rollup and click the Manage Child Trigger button, then click Remove.
July 19, 2016 at 1:41 pm
I am getting a message that this is no longer available for download. Please advise and send a correct link if it is. Looks like exactly what I need
July 19, 2016 at 4:21 pm
Have you used the package links on the GirHub readme file?
December 9, 2016 at 4:55 pm
Hello Andy, Hope you are doing well. We are going to be using this and including the rollups in our managed package. Love the custom metadata!! Anyway, i am trying to pare down the contents to include only what is necessary to run the calculations in the package. I was wondering if the LookupChild and LookupParent objects are really only used in tests? If so, was there a reason you used those objects and not just a pair of standard objects like Account/Contact?
December 11, 2016 at 6:40 am
Hi I am well thanks! Yeah so those are for testing only, I didn’t use standard objects as they don’t always support the use cases the code needed to test.
April 12, 2017 at 4:58 am
I have installed the Declarative Lookup Rollup Summaries Tool 2.8 and tried creating the same rollup as shown in video but it’s not giving me any results. (https://www.youtube.com/watch?feature=player_embedded&v=6BST-TpyHHk)
Please assist.
April 13, 2017 at 3:25 pm
Can you post this question to the Chatter group listed in the Readme file for the tool. Thanks
April 18, 2017 at 12:42 am
Hi Andrew,
I can’t find the chatter link in readme file.
Could you please provide me the link?
Thanks,
Manglesh
April 18, 2017 at 12:53 am
See community,https://github.com/afawcett/declarative-lookup-rollup-summaries/blob/master/README.markdown
June 20, 2017 at 1:11 pm
Hi,
Great app, I love it so far!
One problem I’m having though:
– I’ve created a Lookup Rollup Summary with Parent object: Account / Child: Task
– I want to catch the date of the last Activity assigned to the Account Owner in account field: Last_Activity_from_Owner__c
– In Relationship criteria I have Activity_from_Owner__c = 1 (which is a Task formula field that returns 1 if the task is assigned to the Account owner)
– in Rollup Details I have Field aggregate “ActivityDate”; Aggregate Operation “Last”.
I’ve activated the rollup etc. but it seems that it sometimes catch the First activity from the Account Owner and sometime the Last.
I haven’t been able to identify any difference in the scenario where the First activity is caught vs. when it’s the Last…
Any suggestions here?
Thanks in advance!
/Y
July 8, 2017 at 12:44 am
Have you set the Field to Order By field?
December 30, 2018 at 3:12 pm
I am looking to find out number of Primary Contacts (Text box) on Account which is associated with Primary Contact(Checkbox) in Contact Object. For all Primary Contact (Checkbox) on Contact there will be a Primary Contact (Text box) value in Account Object. There can be only One Primary Contact for each Account even though they have ‘n’ number of contacts
January 7, 2019 at 8:06 am
So you should be able to check the IsPrimary https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_accountcontactrole.htm
January 18, 2019 at 4:59 am
Hi Andrew ! Did you come up with a solution to copy old rollups to custom metadata? I tried to move them with Data Loader but when I export them, I get an empty file with 0 successes / errors. Thanks in advance, Przemek
January 22, 2019 at 6:59 pm
Data Loader does not support custom metadata but there is another tool that I have not tried. https://github.com/forcedotcom/CustomMetadataLoader
July 25, 2019 at 8:31 am
Hello, we are interested in this tool, but need to know if it communicates outside of salesforce in regards to the data stored in the fields. I’m not a salesforce professional, however this appears to be apex code sealed inside of salesforce to perform features to improve screen capabilities. Can you confirm this tool does not retain data, particularly outside of the Salesforce Platform. Thank you very much for your response.
September 2, 2019 at 7:57 am
If is 100% native on platform, no external off platform usage
November 26, 2019 at 6:54 am
Hi Andrew,
We have the app deployed with version number 2.11 and have configured bunch of rollups. Now, the Rollups doesn’t seem to be working. Can you please advise!
I have looked up to upgrade the app to see if that solves the issue and I didn’t find the app on appexchange.
Thank you!
December 28, 2019 at 7:31 pm
Hard go help with no details at all. Please consider giving more information before asking for help. Also use the dlrs community chatter group which is linked from the main GitHub repo readme file. Thank you!
Pingback: Declarative Rollup Summary Tool Update | Andy in the Cloud