Summer ’19 introduces Enhanced Related Lists
Check out this great video to see Enhanced Related Lists in action.
Enhanced Related Lists may be all you need before implementing the solution outlined in this blog post. If not, continue reading =)
In this post I will show you how to use native related lists to separate and filter records with NO code and NO visualforce.
Have your users ever asked for a way to filter related lists or have multiple related lists that separate records based on criteria – much like how Open Activities and Activity History related lists separate Task records based on their status?
A common request I get is how to filter the Contacts related list on Account page, for example, to separate out “Active vs. Inactive” contacts. Or filter out HubSpot noisy activities from the real meetings and logged calls entered by the sales team. Or for customers who track forecasting opportunities along with actual orders in same Opportunity object but with different record types, how to show them in different related lists.
Sounds reasonable, right? Unfortunately, as of this writing, Salesforce currently does not natively support filtering related lists. There are two big ideas on the Idea Exchange requesting this very feature and are tentatively on the road map (safe harbor):
Workarounds exist but usually involve writing code or using a third-party app. One free workaround is Custom Related Lists by Kevin Poorman (@Codefriar). However, even then these solutions aren’t truly related lists as we know them but rather a fancy visualforce page you add to the page layout in a section among the other fields on the page layout. If you’re ok with using a solution that isn’t a native related list then that may be the way to go for you.
In the Visualforce approach, you’re limited to placing it among a field section on the page layout and can’t position it with the native related lists. So that’s a double whammy – had to write code and it doesn’t match the standard UI of related lists.

Creating multiple related lists each using different filtering logic without any code or visualforce
Going back to our original example of trying to separate “Active vs. Inactive” Contacts, I’m going to show you how to setup multiple Contact related lists you can add to the Account page layout and each related list will filter the account’s contacts differently. This solution involves custom lookup fields and process builder.
Lookup Fields
This #NoCode solution for multiple related lists exploits the fact that every time you add a new lookup field on an object then the object the field references gets another related list showing those child records.
In our Contact example, let’s assume we have a custom checkbox called “Active” and that we want show on the Account page contacts separated out into two native related lists: one for Active contacts and one for Inactive contacts.
Using the lookup field trick, add two new lookup fields on the Contact object that both reference the Account object. You can name these whatever you want, perhaps “Active Lookup” and “Inactive Lookup”. You won’t ever show these fields on the Contact page layout, they are just behind-the-scenes fields to make the magic happen.
Process Builder
Next we will automate using Process Builder the setting and clearing of these two new lookup fields. Whenever one of these lookup field’s value is set then on the Account page layout those contacts will appear in the related list associated with that lookup field. When the field is cleared then the contact record no longer will appear in that related list. And like magic we can now let our users intuitively toggle the “Active” checkbox on the contact page and the system will appropriately separate the contacts between the two related lists on the account page!
Our process will have two decision nodes, one checking if the contact “Active” checkbox is checked (true) and the other if it’s unchecked (false). When the checkbox is checked then we will have an immediate action update the contact record to do two things:
- Set the “Active Lookup” field with the value of the contact’s account ID
- Clear the “Inactive Lookup” field by setting it to value $GlobalConstant.null
As you can imagine, the same two actions occur for the other decision element but vice versa, we’ll set the “Inactive Lookup” and clear the “Active Lookup” fields.
Activate the process then update some contacts to be active or inactive. Add the new related lists to your account page layout and voila! If you wanted, you could remove the standard “Contacts” related list and just keep the “Active” and “Inactive” related lists (to me that feels more like the “Open Activities” and “Activity History” experience of Task records that I was going for).
Custom Buttons
The last step is to now create custom buttons for “New Contact” and “Merge Contacts” for your custom related lists. Check out slide 39 of my presentation for screen shots and instructions. The reason we need to do this is because one, the “New Contact” button on the custom related lists binds the account id name/value to the lookup field associated with that related list (either “Active Lookup” or “Inactive Lookup”) instead of the standard “Account Name” field, and two, because the “Merge Contacts” button isn’t automatically added to the custom related lists. Once you create those custom buttons and add them to the related lists on the page layout you’re golden!
When would one use this vs creating a list view? Thanks
LikeLiked by 1 person
Hi Carol,
Great question! List Views are great for filtering data across many records. However, if you’re really only interested in viewing, to go with the example in the post, only active contacts for a specific account then you need to edit the List View criteria to narrow down to that specific account record. Then if you want to see active contacts of another account then that’s either editing the original List View or creating a second one. Then you want to see the filtered contacts for a third account, etc. See where that leads you?
By using Related Lists then the filtered contacts (or whatever record you’re using this technique with) are already contextually aware of the parent record they belong to. All you have to do is jump to another account page and voila the related lists are filtered and contextually appropriate.
From an end-user experience, I’ve found that providing the multiple filtered related lists has been what appealed to most folks I’ve demoed it to. It works well for simple criteria or if there’s only one or a couple ways you want to segregate the data. Anything more complex then I switch to providing custom links to reports or list views for more advanced and dynamic criteria filtering.
Let me know if you have any other questions!
Thanks,
Doug
LikeLike
This is an elegant solution to a long standing limitation of related lists.
LikeLiked by 1 person
Now that is a really neat trick. Thanks.
LikeLiked by 1 person
This is absolutely brilliant! Thanks for sharing this. My boss will think I’m a genius.
LikeLiked by 1 person
Awesome!
LikeLike
Doug:
I did this for Opportunities and it works great on the Accounts page layout. But, what if I wanted to take this concept one step further and wanted to do this at the application level. We’re storing both customer orders and customer quotes in the Opportunities object (I realize there is now an Orders object but don’t really want to go down that road) and would like to split those out in the UI – so our users would see a main tab for Orders and a main tab for Quotes but they would really just be a “view” of the Opportunities object (based on values in a custom field we’ve added). And of course, the corresponding listviews would need to honor that criteria. I realize I could use listviews (which we are doing now) but just wondered if something like this is even possible? Thanks again for sharing this great idea.
Dave
LikeLiked by 1 person
Hi David,
Yes, that is a great use case! What I would do is create two new account lookup fields on the opportunity. One to represent when it’s a regular “opportunity” and one when it’s an “order”. In this way then you will have two new opportunity related lists to put on the account page layout and you can remove the out of the box related list from the page layout.
Use either workflow rules or process builder to automatically set/clear the new account fields on the opportunity record when it’s record type (or whatever your criteria is) changes, just like in the article’s example tripping off the contact being active or not.
Doug
LikeLike
Regarding having different actual tabs to click, I think your only alternative is list views as you’ve mentioned or visualforce pages.
LikeLike
Hi Doug,
I tried this solution and it works great to filter the Active and Inactive Contacts and get them as a Related List under Accounts. I tried adding New Button (Standard) on the “Active Contacts” Related list and when tried to create a new contact, I am not getting Account name by default (which does when tried from the Standard Contacts Related list), user has to select the Account name manually. Am I missing anything here.
Will be highly appreciated if you can suggest me on this.
Thanks-
Manju
LikeLiked by 1 person
Hi Kusam,
Yes, I should have pointed this out in the blog post. You will need to create a custom button on Contact button to add to the related list in place of the standard New button. Your custom button will have to use URL hack to set the account lookup field. The reason is because related lists auto populate the lookup field associated with itself. Since these new related lists were created because of the new account lookup fields, those are the account IDs the New button on those related lists are trying to populate. When you click New button on the standard contacts related list the standard account field populates because that’s the field that related list is bound to.
I will make an effort to update this post with instructions and screen shots.
Thanks,
Doug
LikeLike
I’ve posted a slide deck about this solution: https://douglascayers.wordpress.com/2015/11/18/salesforce-filter-related-lists-without-code/ Please see slide 39 for screen shots of creating the custom “New Contact” and “Merge Contacts” buttons to add to your new custom related lists. Hope this helps!
LikeLike
I think you have put me on the road to a solution I need. Here is my issue: we have multiple entries for HubSpot in our Activity HIstory. We need to be able to see ONLY the activity created by the sales reps. I have never used process builder. Do you have wisdom on how to proceed? This would be a huge win for my team. Thanks!
LikeLiked by 1 person
I am walking through the steps and do not see Activities as being available in Process Builder. Sigh.
LikeLiked by 1 person
Hi Debbie, Salesforce did poor naming convention with their Activities. The object name you will see in Process Builder will be called “Tasks”. And within Salesforce Setup, you will need to navigate to Activities | Activity Custom Fields and add your new lookup fields there. Hope that helps!
LikeLike
Dang. Well, I should have thought of that but I was so focused on “activity” that my brain didn’t go there. 🙂
LikeLiked by 1 person
Thanks, Doug. This was awesome and worked like a charm. The one bug I noticed though was that when I go to click “new contact” it no longer pre-populates the related account on the new contact edit page. Any suggestions?
LikeLiked by 1 person
Hi Erik,
Thanks for the kind feedback! I have updated the blog post (last paragraph) to point out the gotcha with needing to create custom “New Contact” and “Merge Contact” buttons. I’ve posted a slide deck about this solution: https://douglascayers.wordpress.com/2015/11/18/salesforce-filter-related-lists-without-code/ Please see slide 39 for screen shots of creating the custom “New Contact” and “Merge Contacts” buttons to add to your new custom related lists. Hope this helps!
LikeLike
Thanks, Doug! That did the trick.
LikeLiked by 1 person
Thank you for the slideshare!
I am *attempting* to adjust it based upon my need. Basically, we have sales rep activity buried with Hubspot marketing activity in Activity History. It is a bear to find the “real” activity in the midst of the marketing. I am hoping to be able to split all Hubspot into one related list, and the Sales Rep Activity into another. Fingers crossed for success without having a breakdown. 🙂 Thank you, again, Doug!
LikeLiked by 1 person
Sounds like a great use case! Let me know if you run into any more issues.
LikeLike
Hi Doug, great post, thanks!
I noticed that the new contact button function when using lightning returns the following error message:
Record Type ID: this ID value isn’t valid for the user
Any ideas?
LikeLiked by 1 person
Hi Ken,
Thanks for the kind feedback! I’m not too familiar with the Lightning Experience yet. But since you bring up Lightning Experience, that doesn’t currently support custom buttons like we need in this solution, which does work in Classic. I encourage you to vote up this idea so we can bring the awesome of filtered related lists to the Lightning Experience: https://success.salesforce.com/ideaView?id=08730000000cGX8AAM
But that error message, “Record Type ID value isn’t valid for the user” makes me think that (a) maybe you’re trying to set RecordType parameter in the URL and the value is not valid or (b) you’re not trying to set the RecordType parameter in the URL and your profile does not have any default record type assigned to it.
Could you share what you’re using for your custom button URL?
Thanks,
Doug
LikeLike
Hi, Doug.
Me, again. 🙂
It seems I can only have one look-up against activities so I am now trying to
work around and only have one chunk of information pulled.
LikeLiked by 1 person
Wow, that is a real bummer 😦 You had a great use case too!
LikeLike
Well, you may still be able to get a partial solution going with the one custom Account (or Contact) lookup field. If HubSpot only syncs as “Activity History” then you could use the custom lookup field to create a custom “Activity History” related list without the HubSpot records. The standard “Activity History” related lists would still contain all activities. And if HubSpot only synced as “Activity History” then you would never have those in the “Open Activities” related list to begin with.
LikeLike
Thank you. I was thinking that, as well. I am going to work on it and make Salesforce bend to my will!!! 🙂
LikeLiked by 1 person
Hi, Doug.
I’m back after time away from this.
I think I have what I need, however, in the process builder when I look for the active on the task, if it is false, it has nowhere to go because I can’t have the second lookup field. I would like it to go from Active = false to stop. Is there a way? (I know. I am missing something.) I believe I am fairly close but that doesn’t get me far in Salesforce.
Please help.
Thank you!
LikeLiked by 1 person
Hi Debbie,
Since you can’t use a second lookup field, you can still use a criteria step in Process Builder when the Task’s Active checkbox = False to set the “active lookup” field to NULL. You’re right, you won’t have a second lookup field to technically sort the Tasks into an “inactive related list” vs. an “active related list”. But you can show the “active” ones in a custom related list per the one custom lookup field you defined, and the original related list (Open Activities or Activity History) would continue to show all records.
Am I understanding your question?
Doug
LikeLike
You are – officially – a rock star. It worked. THANK YOU!!!!
LikeLiked by 1 person
One piece isn’t working. The look-up isn’t auto-populating, which is causing error emails to be sent to me. What’s great is that I am so close!
LikeLiked by 1 person
Hi Debbie, I’ve sent you a direct message for us to follow up on this setup. Thanks
LikeLike
Hi Doug, I love this thread. I will be a hero (thanks to you) if I can get it to work. The issue I am running into is in the process builder. It works fine for account tasks as I can choose the [Task].AccountId value but cannot do that for the contacts, opps and leads. Any guidance you can provide is much appreciated.
LikeLiked by 1 person
Hi Heidi,
Glad you like this solution! Let’s see if we can get it working for you.
You may need to create a custom lookup field for the other entities, Contacts, Opportunities, and Leads. The creation of the custom lookup field creates a new related list you can add to your page layouts. Your Process Builder logic would then copy the [Task].WhatId into the appropriate custom lookup field (or blank the lookup field). When the custom lookup field is populated then the tasks will show in your new related list.
Doug
LikeLike
Hi Doug thanks for getting back to me. I did create the look up fields but in PB they look different than the task/account lookup and dont work as intended. Only the Account RL is working. Here are some screen shots to show what it looks like. You help is much appreciated!
https://www.screencast.com/t/M0LHnHZG8w
LikeLiked by 1 person
Thanks Heidi for the screen shots, that was very helpful. I believe the issue is in your Update Records action when performing the field update on the Task record. For example, in this image, the process is copying the value of [Task].Sales_Activities_Opportunities__r.Id into the field labeled “Sales Activities”.
Instead, change “Sales Activities” to the field labeled “Sales Activities-Opportunities” and then where you currently have “[Task].Sales_Activities_Opportunities__r.Id” replace it with [Task].WhatId (the “Related To” field).
So your screen shot would look more like this:
FIELD
Sales Activities-Opportunities
TYPE
Field Reference
VALUE
[Task].WhatId
LikeLike
Awesome post – now I just have to edit all of my Contacts to make it work..?
LikeLiked by 1 person
Thanks Keri-An! Yes, once you have the process setup and activated then you need to do one mass update on existing Contacts to force the records to go through the process and have their lookup fields set accordingly. Going forward, all new or updated Contacts will go through the process automatically.
LikeLike
Yeah – managed to do that for all but 1000 of my contacts for some reason I’ve had to work through manually. One problem I’ve come across though is that with Duplicate checking turned on, it seems to crap out…
An error occurred at element myRule_1_A1 (FlowRecordUpdate).
UPDATE — UPDATE FAILED — ERRORS : (DUPLICATES_DETECTED) Looks like this could be a duplicate record. Check out any existing records and see if you can use one of them instead.
This is the error that comes through after ignore/save anyway has been hit..??
LikeLike
Hi Keri,
Are you having problems with doing the one-time mass update or does it still error out when you are marking a single contact as active/inactive in normal use?
If it’s isolated to the one-time mass update then try disabling Duplicate Rules for the duration of your update then re-enable them.
If the error is occurring when you manual edit one contact in the UI please share more specific details about your setup so I might try to reproduce on my end.
Thanks,
Doug
LikeLike
Hi Doug,
Not on mass update – updating single records. We have the standard Contact matching rule and the duplicate rule has the following settings:
Record-Level security – Bypass sharing rules
Action on Create and Edit is set to – allow
Operations on Create and Edit are set to Alert and Report
Matching Rule for both Contact and Lead are standard, and Matching Criteria is set to Matching rule for contact/lead records
There are no Conditions set
The Process builder is set up exactly like yours, except that our checkbox on Contacts is called Inactive and is off by default and on where someone is Inactive (so is sort of opposite to yours on that count).
The only other Process updating Contacts is when we check the email opt out box – we have some categories of opt outs that we also check when they opt out of all.
We have workflow rules that update City, state and country to upper case on Contacts. And one that fires an email off if the inactive check box is checked and they also have another checkbox on the record checked (for our software admins).
Nothing else I can see is updating the Contact records.
I have managed to save the records when I deactivate this process and then can merge the duplicates without an issue – but for some reason can not get the record to save at all if this process is still active.
Thanks for your help,
Keri-An
LikeLiked by 1 person
Hi Doug, same issue here. Any update? Thank you in advance
LikeLiked by 1 person
Hi Rene,
My guess is that on the Duplicate Rule the “Operations on Edit” value of “Alert” may be causing the issue. I haven’t heard back from Keri-An if she ever worked out a workaround.
Doug
LikeLike
Hi Doug, I am facing the same issue like Keri-Ann and I don’t know what else to do. Users need the duplicate rules activated. I had built the process like in your page, but unfortunately and fo some reason I don’t know yet, the process is in conflict with the Contact duplicate rule. I would appreciate any help here. It has been days trying to solve this.
LikeLiked by 1 person
Hi Mary,
Have you tried modifying the “Action on Edit” for your duplicate rules without de-activating them completely? Perhaps some combination of “Allow” and checking on or off the “Alert” and “Report” options may work for you?
LikeLike
Hi Doug-
Great Article- I plan to dive into a variation of this in my org, but have one question. This doesn’t create new objects, does it? Rather it’s just displaying contacts based on filters, but regardless if you click on James Dean in the example, it will take you to one contact page, is that correct? I just want to make sure that activity is being logged to the correct contact, and that this solution does not create a scenario in which there are two “James Dean”s. That would be a hiccup that would prevent us from using this solution.
Regardless of the answer, thanks for posting! Very helpful.
-Rob
LikeLiked by 1 person
Hi Rob,
Thanks for the kind feedback! No, this does not create new records. It is smoke and mirrors to make the single record appear in more than one related list by having multiple lookup fields on the child object that reference the parent object. Regardless from which related list you click on the contact record, say James Dean, both would take you to the one detail page for that one contact. If this solution created duplicate records it would be a hiccup that would prevent anyone from using it! 🙂
Best of luck. I’m curious what your variation use case is, mind sharing?
Doug
LikeLike
Doug,
This has changed our ability to view things in Salesforce DRAMATICALLY! I love it – when I log in I can now see what inflight opportunities we have, current contact negotiations, and what contracts are being worked on. Game changer.
My only issue is – I keep getting an email that:
An error occurred at element myRule_1_A1 (FlowRecordUpdate).
The flow failed to access the value for myVariable_current.Account.Id because it hasn’t been set or assigned.
Everything still seems to work fine. But I get about 20 emails a day!
Have you seen this before with this solution?
Heidi
LikeLiked by 1 person
Hi Heidi! Thank you for your comment, that made my day!!!
Based on that error, I imagine that the record’s Account field may be blank and so when trying to reference [Record].Account.Id then process builder blows up because it can’t actually reference the Account’s Id because there is no account to reference.
One way to defend against this is in your process builder’s criteria step to check that the record’s Account lookup field is not null. Check out #3 on this blog post: http://succeedwithsalesforce.com/5-areas-in-salesforce-where-null-checks-must-be-performed
A second way to defend against this is that if you’re only needing to reference the Id field from a lookup relationship, reference the lookup field directly without traversing into its own fields. For example, on Contact object, you can reference the account’s id in a null-safe manner by referencing [Contact].AccountId rather than [Contact].Account.Id. The latter example will blow up if the account lookup field is null whereas the first example will not blow up.
Hope that helps!
Doug
LikeLike
You’re a GENIUS! That worked like a charm. Thank you so much for the speedy response. My email box thanks you too 🙂
LikeLiked by 1 person
Awesome!!! Glad to help! Thanks for the follow up 😉
LikeLike
Doug,
I have a related list on my contacts for “Positions” (custom object – MD to Contact). Positions have a start date but as of now not all of them have an end date which makes the related list messy. Do you think this process would work to filter the Position related list so those with end dates are on a separate related list?
LikeLiked by 1 person
Hi Karen,
Thanks for your comment. Yes, that is a great use case and this process would work well! Following the example outlined in my blog post, instead of your process checking whether an “Active” checkbox is true or false you would instead have criteria that checked whether the End Date is null or not. If there is (or is not) an End Date then update the appropriate lookup field to show/hide the record from the desired related list.
Doug
LikeLike
Doug – have you done this with Campaigns/Campaign Members to filter the related list that shows on Contact or Lead?
LikeLiked by 1 person
Hi, could you elaborate on this use case? Are you wanting two lists on campaign, one for leads and the other for contacts? I have not tried that but sounds fun. Hopefully CampaignMember allows custom lookups to lead and contact.
>
LikeLike
Hi Doug,
I’m completely new to SFDC but I do have CRM experience. I was asked to set-up a similar situation for a custom object called Account Staff that we have set up. I followed your procedure and everything looks fine and it was easy to set up. I activated the process but when I change the status and save the record I get an exception error. I was getting that I was putting the wrong id value and realised I was putting the account staff id back into the reference! Anyway I’ve gone to change it and the links through to the parent account are slightly different to what you show here. There is no account id on the account staff table. So I had to drill into account staff again and then I saw a parent account and then within that was an account id. I used that but same result. I’ve also tried using the master account but I still get the exception. Do you have any clue of what I might be doing wrong and what field I should be trying to put into the lookups?
Thanks,
Kev
LikeLiked by 1 person
Hi Kevin,
Welcome to the Salesforce Community! To help troubleshoot, could you share some screen shots of the
Account Staff
custom object’s fields in Setup as well as how your process is configured? You can use http://imgur.com/ to upload the screen shots. If you can share the error log from process builder you’re getting that would be helpful too.In general though, the
Account Staff
object likely has a master-detail or lookup field to another object (e.g. Account). And when viewing the detail page of that referenced object (e.g. Account record) then a related list of Account Staff records will display (if its been added to the page layout). You will want to add more lookup fields on theAccount Staff
object that reference the same object type that the original master-detail or lookup field reference (e.g. Account). In Process Builder, the immediate action step will do an Update Records action and needs to either copy the value of the original master-detail or lookup field into your custom lookup field or set the custom lookup field to null.Thanks,
Doug
LikeLike
Hi Doug,
Thanks for the quick reply. I feel like I’m doing everything right but I must have missed something somewhere.
I’ve uploaded the table layout, the process builder sections and the error msg I’m receiving.
If you can spot anything I’m doing wrong I’d be grateful.
Thanks,
Kev
LikeLiked by 1 person
Thanks for the screen shots, Kevin, that helps a lot! I believe I’ve spotted the error. In your Update Records action, when assigning the value to the Active Lookup or Inactive Lookup fields, reference just [Account_Staff__c].Account_Staff__c instead of [Account_Staff__c].Account_Staff__r.MasterRecord.Id.
On an Account or Contact or Lead object (objects that can be merged together), there is a MasterRecord field that is populated by Salesforce itself during merge operations. The record that got merged into another is deleted and will have its MasterRecordId field pointing to the surviving record post merge.
The error your received in the email about “The flow failed to access the value for myVariable_current.Account_Staff__r.MasterRecord.Id because it hasn’t been set or assigned.” was because the related account’s MasterRecord field is null and could not be referenced to grab it’s Id.
To add to the confusion, the master-detail field on the Account Staff object that points to the Account it belongs to is also named Account Staff. I recommend changing the name, or at least the label, to simply be Account.
Hope that helps!
Doug
LikeLike
Thanks Doug. It appears my confusion lay with how they had labeled the relationship field. Calling it Account Staff as well was making me think I was calling the same record when in fact I was linking back to the account record. It’s working now. It is a bit confusing that a master record is a merge record but the relationship between the custom object and the account table is called a master-detail record. Hmm I guess I’ll get used to the little quirks. Thanks for your time.
LikeLiked by 1 person
what about the Existing contacts in the standard Contact related list. when i created a custom new button, the existing contacts were not visible . How to move the existing contact to new related list.
LikeLiked by 1 person
Hello,
Please see my comment at the bottom of the post about needing to create custom buttons. Also check out slide 39 of the presentation linked at the bottom of the post too which walks through creating the buttons with URL hacks.
The reason we need to do this is because one, the “New Contact” button on the custom related lists binds the account id name/value to the lookup field associated with that related list (either “Active Lookup” or “Inactive Lookup”) instead of the standard “Account Name” field, and two, because the “Merge Contacts” button isn’t automatically added to the custom related lists. Once you create those custom buttons and add them to the related lists on the page layout you’re golden!
Hope that helps!
LikeLike
Hi Doug thank you for this tip! I wanted to comment on updating the Contact records. We have about 21,000 records and there was no way I was going to update them one-by-one to put them in the Active and Inactive lists, so I exported all records in my Contacts object with just the ID and Active field (through Data Loader) and then did an Update using the same file. It looks like the Update does run the records through the Process Builder process and did separate them into the Active and Inactive lists. Thanks again for the excellent idea!
LikeLiked by 1 person
Great! Thanks for the feedback and I’m glad it worked for you. You are exactly right, after implementing the solution if you have existing contacts then use data loader to mass update the records; process builder will do the magic of filtering them into the right lists. =)
LikeLike
Hi Doug,
Thanks for sharing this intelligent idea.
One question: I am trying to change contacts status(Active/Inactive) based on their activities (Meeting) but, process builder is not letting me do that. It works only if the actual contact is modified like first name, phone etc.
Is there any workaround for that?
Please assist.
Thanks,
Manglesh
LikeLiked by 1 person
Hi Manglesh,
Check out my other blog post about how to update a lead or contact based on activities: https://douglascayers.wordpress.com/2016/06/21/salesforce-how-to-update-lead-or-contact-when-activity-logged/
If I understand your use case, then using this solution you’d have a process builder on Task or Event object and update the related Contact’s status. Another process would monitor for the contact being edited and would populate the correct lookup fields so that the contact now shows in the desired related list.
Doug
LikeLike
That is so smart! Unfortunately I’m trying to do something similar with Tasks and apparently activities do not support 2 lookup fields to the same object. Any ideas of how this could be achieved? The goal is to be able to split activities into separate related lists based on their type.
LikeLiked by 1 person
Hi Silvia, thanks for the kind feedback!!
As you’ve discovered, unfortunately the Task object only allows one custom lookup per object, so we can’t create two. I think the best you can achieve here is to filter into one custom related list some Tasks that are really important to you and then the standard related list will contain every Task. Not ideal, no, but the best we can do with this solution with what Salesforce limited the Task object to.
LikeLike
Thanks Doug Ayers it was helpful
LikeLiked by 1 person
Thanks for the kind feedback!
LikeLike
Hi Doug, genius idea here. My use case is separating anticipated opportunities from “true” opportunities based on the Stage. The tricky part is making this process work for both opportunities from Contacts and opportunities from Accounts. For my org, opportunities from an individual have a Primary Contact field filled in, but opps from an Account have that field blank. My first gut is to make two processes. I’ve gone through Process Builder and creating the custom buttons for the opportunities from individuals, and it all works fine when I create a new opportunity for an Individual. However, I’m getting an error when I try and create an opportunity from a Account because one of my criteria is that the Primary Contact field is not blank. So when I create an opportunity where it IS blank, I’m getting an error. I feel like this should be a quick fix, help?
LikeLiked by 1 person
Hi Doug, turns out I have a checkbox field for “Has Primary Contact”, so I was able to use that to filter out opportunities where no primary contact is set!
LikeLiked by 1 person
Hi Doug, now I’ve run into a separate problem. One thing I find great about this solution is that in your example, contacts who are currently inactive can be made active again, and the contact will move from one related list to another. I just tried to change the stage of an anticipated opportunity to make it a “true” opportunity. I was unable to save the record, and I got this error report:
Error occurred attempting to get data type for : RawFieldImpl[tableName: Opportunity, columnName: Projected_Gifts__c]
LikeLiked by 1 person
Hi Karen,
Thanks for the kind feedback! Interesting idea to separate opportunities based on their stage, this should work nicely.
Can you please post screen shots of your configuration for troubleshooting? You can use a free website like imgur or postimage or google doc then provide link here.
My initial idea towards how to implement this solution is that since an opportunity could be related to an Account or to a Primary Contact then we know we have to be building related lists that can be added to both Account and Contact page layouts. This means that for each logical related list we want to create, like one for Open opportunities and one for Closed opportunities then we actually need 2 custom lookups per list, one that can be added to Accounts and one that can be added to Contacts. For this simple scenario of Open vs. Closed then we’d need a total of 4 custom lookups ( 2 x Account + 2 x Contact ).
I believe a single Process Builder and be used in this solution. Instead of filtering on if a checkbox is true or false you might be filtering on specific Stage names.
In my example of Open vs. Closed opportunities, in the first stage decision it would have an Update Records action that would populate values into the 4 custom lookups. It would copy the main Account ID into the custom account lookup for this related list as well as copy the Primary Contact ID into the custom contact lookup for this related list. Then it would set to null the other two custom lookup fields that represent the other related list.
Hope that helps!
Doug
LikeLike
How would I do this for specific contact record types? I have two different contact record types that I would like to display in their own related lists.
Thanks!
LikeLiked by 1 person
Hi Chad,
In the example in the blog post the Process Builder filters on an Active__c checkbox to know which custom Account lookup field to set or clear. For creating different related lists based on contact record type then instead of having criteria on Active__c being checked or not you would instead filter by the Contact’s Record Type Name.
Doug
LikeLike
I just came across this posting and still trying to absorb the process. By default, a user that owns an account can see all child contacts on that account. I’d like to only show the user their own contact and keep the rest invisible. Is this possible in the scope of your solution?
LikeLiked by 1 person
Hi Michael,
No, this technique cannot hide contacts dynamically based on who is viewing the account. You might consider changing the organization-wide default sharing of contacts from “controlled by parent” to “private”.
https://help.salesforce.com/apex/HTViewHelpDoc?id=admin_sharing.htm&language=en_US
LikeLike
So clever!
LikeLiked by 1 person
Glad you like it Rhonda!
LikeLike
Thanks Doug! Great solution.
LikeLiked by 1 person
Thanks for the kind feedback, Vance!
LikeLike
Dear Doug – thank you. This is amazing. I do have a question. WIll this work for Custom objects? I have created the 2 additional lookups for Active/Inactive but rather they haven’t been added to the object page as a related list – they have been added as expanded lookups and don’t display. Any advice would be greatly appreciated.
LikeLiked by 1 person
Hi Susan,
Thanks for the kind feedback. Yes, this works with custom objects too. Could you provide screen shots of your setup and what you see on your page layouts? Are you using Classic or Lightning Experience?
After creating the new lookup fields you will need to add the new related lists created per them to your page layouts on the parent object.
Thanks,
Doug
LikeLike
Hi Doug,
This works awesome, But one question. What can we do for the existing records which are inactive. ?
LikeLiked by 1 person
I got it myself. Just did Dummy update on contact records and it worked. Thank you very much once again. Awesome trick.
LikeLiked by 1 person
Hi Vivek,
Thanks for the kind feedback!
As you discovered, yes, for pre-existing records you would need to do a simple tickle update on those records to cause them to go through the Process Builder so that the lookup fields get populated correctly.
Thanks,
Doug
LikeLike
Dear Doug,
Thank you for the great article.
I have successfully created this process builder. My current situation is that we already migrated to the org. I(Admin) have to make the active/inactive contact update for all contacts. When I am trying to update this, I am getting an error stating that Error Occurred: Too many SOQL queries: 101. Do I have to take the path of scheduled timer on my process builder?
Kindly advice. Thank you.
LikeLiked by 1 person
Hi KR,
Thanks for the kind feedback!
Regarding the updates to existing contacts so that your Process Builder runs to backfill the inactive/active lookup fields, you may need to use Data Loader with a lower batch size than 200 records. I assume there is other processes or triggers in your org that are doing other things and thus mass updating contacts (and whatever that cascades into in your org) is exceeding governor limits.
https://developer.salesforce.com/docs/atlas.en-us.dataLoader.meta/dataLoader/configuring_the_data_loader.htm#configuring_the_data_loader
LikeLike
Hi Doug,
Awesome post! I came across looking for a solution for sorting Pardot emails into a custom Activity History related list (similar to Debbie’s need for Hubspot). As Debbie had mentioned, you can’t have two different look ups from the Activity object to the same object, like Accounts. However you could have a separate lookup to Contacts and one to Accounts and still use your process of updating these fields through Process Builder.
I’m not sure how Hubspot works, but Pardot always fills out the Contact lookup on an Activity. Most other activities will be related to the Account, so I can filter it out.
LikeLiked by 1 person
Hi Stephen,
Thanks for the kind feedback about my post and info regarding Pardot.
Doug
LikeLike
Hi Doug! So I am trying to use this solution to create a Cases related list that only shows Cases of a certain RecordType – I think Im good on how to go about it from the Lookup Filed to the Process Flow – however I am foreseeing an issue. Since the Process Builder flow will need to be kicked off by either a)Case Record is Created or b)Case Record is Edited – what about all the Case records that are out there right now? Is there a way to make the process of setting the lookup field “retroactive”? If not, I thought maybe I could add a checkbox or something and then set that using Dataloader for existing records (to cause the Update event and kickoff the Process).
LikeLiked by 1 person
Hi Eric,
For historical records, use Data Loader to export the Cases then perform and update again. You only need the ID field and don’t have to actually modify any field values. The act of using “update” operation with Data Loader should suffice to kick of Process Builder.
LikeLike
THANKS!!!
LikeLiked by 1 person
Doug – this article is brilliant and just what i was looking for. I have literally spent hours looking for a solution to “filter” the activity history to remove all our hubspot activity so it was great to discover this gem.
I inherited our SF 12 months ago and am slowly getting it into good shape. This was a big thing that i wanted to achieve – to remove the marketing noise making it easier for the sales team to see what was “actual” activity – we have turned off the tracked at the hubspot side of things but still need “remove” the historical hubspot activities.
I am ALMOST there i think but would really appreciate a few moments of your wisdom please?
I am at the point where I have created the process builder however on activating it i immediately received email notifications with an error.. can you point me back on the right track?
My process builder is set up as:
Object – TASK
CRITERA – hubspot sent (custom field) equals picklist yes
… TRUE update record
Activity History Exc Hubspot (custom field) globalconstant $GlobalConstant.Null
and false being…
Activity History Exc Hubspot (custom field) reference [Task].ID
The email notification reports:
An error occurred at element myRule_3_A1 (FlowRecordUpdate).
UPDATE — UPDATE FAILED — ERRORS : (FIELD_INTEGRITY_EXCEPTION) Activity History Exc Hubspot: id value of incorrect type: 00T7000004rDUfuEAG
Can you spot my mistake? I’ve set this up associated to Accounts and now im wondering if i need to do it against Contacts and Leads as well? Instead???
Thanks in advance
Kellie
LikeLiked by 1 person
Hi Kellie!
Thank you for the kind feedback. And kudos for progress cleaning up your inherited org (we can be handed messes sometimes!).
Another reader, Debbie, had your same use case. Be sure to read through our comments back in April and May 2016 to see if they help.
In short, the Task/Event objects (Ill call them Activities) only support one custom lookup field per other object. That is to say, you can create one custom account lookup field, one custom contact lookup field, etc in Setup | Activities | Activity Custom Fields.
I don’t have experience with Hubspot, but per Debbie’s comments it sounds like those activities always sync over in the “Activity History” related list and never in the “Open Activities” related list. If so then that works in our favor considering we can only create one new custom related list per parent object. So we can rely on standard “Open Activities” related list as-is to not show Hubspot and then we will create custom “Activity History” related lists for any standard or custom objects you want.
What I recommend to start with is create one custom lookup field to each of: Account, Opportunity, Contact, and Lead. Once you get this in place you just rinse and repeat for other objects. I chose those objects because they are two examples each of objects that could be related to the activity via the “Related To” or “Name” standard lookup fields on activities.
In your Process Builder your Decision steps will need to inspect the “Name” (WhoId) and the “Related To” (WhatId) to know what the Activity is currently related to to know which custom lookup fields to populate (the account, opportunity, contact, or lead, etc).
We will be using a trick known as object key prefixes to distinguish which object type the dynamic Who/What standard lookup fields on Task are actually pointing too. I encourage you to read and watch my Automation Hour webinar on How to Update Lead or Contact When Task Updated to see this trick in action.
For example, your first Decision might check if:
1. The Task’s “Related To” (aka [Task].WhatId) starts with “003”. That means it’s related to an Account, and
2. The Task’s “Closed” field is true, and
3. Some field that indicates this is from Hubspot
If all three conditions are true then you want to assign the Task’s “Related To” (aka [Task].WhatId) value into your custom account lookup field. At the same time, you’d also want to assign null to any other custom lookup field on your activity that could have been assigned by the “Related To” field. In our example, that would be the custom Opportunity lookup field. So set that to null. We don’t do anything with the custom contact or lead lookup fields yet, we are only focused on the “Related To” field at the moment.
Your second Decision might check if:
1. The Task’s “Related To” (aka [Task].WhatId) starts with “006”. That means it’s related to an Opportunity, and
2. The Task’s “Closed” field is true, and
3. Some field that indicates this is from Hubspot
If all conditions are true then you want to assign the Task’s “Related To” (aka [Task].WhatId) value into your custom opportunity lookup field. At the same time, you’d also want to assign null to any other custom lookup field on your activity that could have been assigned by the “Related To” field. In our example, that would be the custom Account lookup field. So set that to null.
The next two Decision steps in your Process Builder will be just like the first two with these changes:
* Instead of checking Task’s “Related To” field we will now check the Task’s “Name” (aka [Task].WhoId)
* To check if the activity is related to a contact check if the WhoId starts with “003”. If true then set the contact custom lookup field same as Task’s “Name” id and set the lead custom lookup field to null.
* To check if the activity is related to a lead check if the WhoId starts with “00Q”. If true then set the lead custom lookup field same as Task’s “Name” id and set the custom contact lookup field to null.
After you have all four Decision steps configured with their Immediate Actions to update and assign the appropriate lookup fields (each update action will assign either the [Task].WhatId or [Task].WhoId to a custom lookup field and assign null to one or more other custom lookup fields).
We won’t ever be assigning [Task].Id to any of these custom lookup fields. One, we can’t because we can’t create custom task lookup fields and two because that would only create a related list on the task object, which we don’t want. We want to make custom related lists on the parent objects like accounts, opportunities, contacts, etc.
Now, at the end of each Decision element on the far right is something labeled “Stop”. Click on each one and if able change the value to “Evaluate Next Criteria”. You should be able to do this for all Decision rows except the last one at the bottom.
Activate, test it out, have fun.
Doug
LikeLike
Great – thanks Doug.. I am almost there and its looking good! My custom related lists are working for Opportunity, Contact and Lead pages… but for some reason its not rolling up for the Account page?
I followed your steps but I guess I am missing something! I have created the custom fields for the related objects; campaign, opportunities, quotes, orders (as well as contacts and leads) and set all of these to null… I guess there are other related fields i haven’t considered. Is there an obvious place i can find a list of these in SF? I presume once I have every related object set to null this will work.
Kellie
LikeLiked by 1 person
Awesome!
Please share screenshots of your config for the Account pieces. You may use free service screencast.com or other public file sharing like Google Drive.
Tasks can be related to any object that allows activities. For standard objects, this already includes Accounts, Opportunities, Campaigns, etc. For custom objects this must be enabled in the Setup page by selecting the Allow Activities option. To see a complete list one trick is navigate to an email template in Setup then click the preview button to test and verify merge fields, in the pop up will show a picklist of the related object to test. Those are all the objects in your org that support activities.
You do not have to set every other lookup field on your task to null to get the account related list to work, only populating or clearing your custom account lookup field. Do note that activities have a standard AccountId field, [Task].AccountId, that you don’t want to be using but rather the custom account lookup field, [Task].Account__c (or whatever you named it).
Doug
LikeLike
I’ve just sent you the screen shots via google drive – let me know if you dont get them. TIA
LikeLiked by 1 person
Hi Doug,
I’ve tried to use your method to show 2 new opportunity related lists on Contact records, each related list is based on a different record type.
I created 2 lookup(Contact) fields (one per record type) in the opportunity object.
I’ve then created a process with the PB like the one shown in your instructions below. The conditions of the PB are actually based on opportunity record type ID.
Unfortunately, it doe snot seem tyo be working as the lookup fields don’t get populated at all.
There may be something wrong in my setup?
LikeLiked by 1 person
Hi Mario,
Please share screen shots of your config. You may use free service screencast.com or save the images to a public file share like Google Drive, etc.
Regarding record types, make sure your Decision conditions are referring to the [Opportunity].RecordType.DeveloperName (in the field chooser it’s labeled Opportunity > Opportunity Record Type > Record Type Name, I think). This ensures you’re not hard coding the ID which will change from sandbox to production if you ever are building something with record types that are new in sandbox to be deployed to production. https://polymathforce.com/2017/01/18/lessons-learned-record-type-ids/
Thanks,
Doug
LikeLike
Hi Doug, see here: https://www.dropbox.com/s/x3drww9uh19tcyv/RelatedListbyRecordType.avi?dl=0
LikeLiked by 1 person
Hi Mario,
Thanks for the detailed video overview of your Process Builder. It looks correct. From the video my only question is are you sure that the Decision criteria is correct? That is, are you certain there are no typos in what the [Opportunity].Record_Type__c custom field value is and the text you are comparing to? Be cautious about case sensitivity, extra whitespace, etc.
I’m assuming the [Opportunity].Record_Type__c is a formula field? Something like RecordType.Name or RecordType.Label?
Have you tried with different criteria to rule out any nuance with [Opportunity].Record_Type__c field? Maybe try based on the selected Stage just to see if you can get things to fire between “Closed Won” and “Closed Lost”, for example.
Doug
LikeLike
Doug, thanks so much for your help.
Our opps are automatically renamed according to the record type, so I used opportunity name contains to formulate the decision. It works now!
Thanks so much for your help!
LikeLiked by 1 person
Great! You’re very welcome, Mario!
LikeLike
Account setting screen shots:
https://drive.google.com/drive/folders/0B2-Dk3LraCciS0t2azFwNFNoYmc
LikeLiked by 1 person
Thanks Kellie. I did not receive the email. I’ve requested access to the file, can’t view it yet.
LikeLike
Hi Doug, Question.. how does this change with Lightning. Specifically, around the custom button part – we have multiple recordtypes and need to pass both the account name and recordtype to the new button. Have you been able to play around there since the latest release?
LikeLiked by 1 person
Hi Jake,
To my knowledge there is no way via custom URL button preset form field values like we could in Classic.
Some options:
Use Quick Actions, http://salesforce.stackexchange.com/questions/116697/create-record-in-lightning-with-populated-fields
Use custom URL button to launch Flow where you collect fields and set values as appropriate
Doug
LikeLike
Are there possiblities to get the below error from this process builder though the process builder performs the expected job ? The error does not give me further information and I am stuck with it
developer script exception : Command : Invalid id :
caused by: System.StringException: Invalid id:
(System Code)
LikeLiked by 1 person
Hi KR,
I’ve not run into that error before personally. When does that error show up? At the time you save the record or do you only see it in debug logs? Does the error occur when updating a record or within Process Builder itself when you’re creating/activating the process? Are you able to reproduce the error reliably or does it happen sporadically?
All in all, I suspect that it’s probably other code or something being triggered when you’re updating the record. Or perhaps an invalid formatted ID value is being copied into the custom lookup fields.
Thanks,
Doug
LikeLike
Thank you for your response Doug. I did not get enough information from the error emails that I received. After further investigation, it was because of the APEX trigger from SOF. Ignore my question and thank you for your response.
LikeLiked by 1 person
Hi Doug – thought i would give a quick update on my Custom Activity List (build to exclude hubpot/ marketing activity)
I am still working through this “journey” and the help you provided has been great.
Through the use of a few custom fields, workflows and the process builder as you described, We now have a custom activity list showing our sales team activity excluding all marketing/hubspot noise. This is working against our contact/ lead and opportunity records.
I have encountered a few issues that I am still trying to resolve, which I thought I would share incase you or anyone else has come across these..
For whatever reason i simply cannot get this to work against the Account record. I have walked away from this for now – my focus was against contacts and leads so happy enough for now but it would be great to revisit this in future.
I was unable to clean up the data help against the historic lead record before conversion due to the way salesforce locks down lead data, meaning dataloader cannot access it! All activity post conversion is showing though. Works fine for all leads converted post implementation of this process – just means that for now i need to show both the original activity list and the custom activity list on the record so we have full visibility of the activity – given enough time this will not be relevant
This is the biggest issue right now – I cannot get the process to update those activities creating using the Email to salesforce (Bcc or plugin) functionality. It seems as though these activities are created “unseeen” and simply slide into the activity tasks without going through a record created/ saved process and therefore hitting the workflow or process builder triggers. I have been working with the Salesforce team and had hoped that creating an Apex trigger against these tasks would help – but no luck as yet – so I am currently manually updating all email task entries by reloading them into salesforce using dataloader daily – not great but my only workaround currently.
And my final thing to do/ fix is to create custom buttons for send email / log a call – as per the standard buttons against the activity list (so that I can actually remove the activity list from view). Slightly apprehensive as it sounds like the way to do this is by VF? That’s next on the list once I figure out no.3. If you/ anyone has done this I would be very keen to find out how!
Thanks again for all your help – we are almost there!
LikeLiked by 1 person
Hi Kellie,
Regarding when email activities are created via “Email to Salesforce” (BCC) or via a plugin like “Salesforce for Outlook” then check if you have Enhanced Email enabled. If yes, then Salesforce creates an EmailMessage record and you might be able to have a Process Builder monitor that record since your process on Tasks is not firing.
Behind the scenes when Enhanced Email is enabled then both an EmailMessage and Task record are created but workflows / processes might only be firing for the EmailMessage object. If that’s your situation then a process on EmailMessage object could run a Flow that runs a simple Record Update on the Task whose ID equals the EmailMessage.ActivityId so that your original process on Tasks fires.
Doug
LikeLike
Doug, I ran across this page. It is a really brilliant solution and was simple enough for me to implement in 10 minutes. I was wondering if you could answer a question. I created some VF inline related lists with the following code:
Now, by following your idea – I created a filtered related list with exactly what I need. But I cannot figure out how to use this filtered related list to create a similar VF inline related list. The new related list name is
Cash Receipts (Active lookup)
No matter how I plug that in to the above VF code – I cannot get a valid display.
Any suggestion would really be appreciated.
LikeLiked by 1 person
Hi Howard,
It seems your code has been stripped out of your comment. Do you mind re-posting the code on https://gist.github.com/ then sharing the link to it here?
In Visualforce, you can use the apex:relatedList tag to display a related list. The list attribute should be the API name of your relationship field.
Thanks,
Doug
LikeLike
Hi Doug,
Will this work for Activities. I want to separate activities on account, like AR activities and Sales Activities.
Thanks
Tarun
LikeLiked by 1 person
Hi Tarun,
Yes, but this approach is limited with Activity object (Tasks/Events) because that object only allows one custom lookup field per object whereas most other standard and custom objects support multiples.
Please see this earlier thread for more details and another reader’s approach.
Thanks,
Doug
LikeLike
Appreciate your prompt reply !!!
LikeLiked by 1 person
This is amazing – thank you for sharing Doug. I’m going to give this a try 🙂
Im thinking about taking this one step further using the new Dynamic compenent on Salesforce Lightning. If there are no inactive users I dont want the related list to show.
I have one precious ‘free’ roll up helper remaining that I can use to roll up the number of active contacts… in your opinion would this be the most efficient way to work with the dynamic feature as standard roll ups can not roll up contacts.
LikeLiked by 1 person
Hi Sarah,
Thanks for the kind feedback!
On the topic of roll ups, I recommend Andy Fawcett’s free tool: https://github.com/afawcett/declarative-lookup-rollup-summaries
There’s no limitation on number of roll ups you can make with the tool, it’s free, open source, and has a dedicated Success Community group for support.
Neat idea about hide/show single related list with the Visibility filter in Lightning App Builder.
LikeLike
This was absolutely genius thanks! Worked a treat for multiple related lists based on product categories.
Thanks!
LikeLiked by 1 person
Thanks Warren, glad you like it!
LikeLike
Hi Doug,
This is a great workaround until Salesforce, hopefully, makes this standard functionality. I’m using it for opportunities etc.
I’m new to Salesforce and it seems that some things have changed in Salesforce regarding Contacts and Related Contacts on Accounts since you wrote the article (please correct me if I’m wrong).
I’m using Lightning Experience and it seems that you are not able to add custom Look Relationship fields to the AccountContactRelation Object. I really like the Related Contacts on the Account Object but it would really make sense if I was able to filter between Direct and Indirect relations.
Do you know if this is possible somehow?
BR,
Niels
LikeLiked by 1 person
Hi Niels,
Thanks for the kind feedback, glad you like this solution!
Unfortunately, the AccountContactRelation object does not seem to support custom lookup fields so we cannot employ this trick here.
I really like your idea though on filtering between direct and indirect contacts. Please make sure to create or vote for this idea on the IdeaExchange and/or follow up with the product managers in the Salesforce People group on the Success Community.
Thanks,
Doug
LikeLike
Good solution, thanks!
LikeLiked by 1 person
Thanks, glad you like it Josh!
LikeLike
Good Solution Dough.
I believe there is a limitation to this approach, the standard button like Merge Contact is not available to add to the new Related Lists.
Do you think is it possible ? I tried, was unable to find standard button, other than New Button.
Thanks
Megha
LikeLiked by 1 person
Hi Megha,
You may need to create custom buttons and add them to the new related list.
LikeLike
Thanks for your reply Dough.
Does that mean a new Contact Merge functionality as well ?
LikeLiked by 1 person
Hi Megha,
No, you don’t have to re-create the merge functionality. You only need to create new custom URL buttons then add those buttons to your related list. Please see slide 39-44 in my presentation.
Thanks
LikeLiked by 1 person
Thanks ! That’s helpful.
LikeLiked by 1 person
We have a LOT of Contact records in Salesforce. If we wanted to implement the Inactive vs. Active solution, would we have to use Dataloader to retroactively update the Lookup Field on all existing Contact records?
LikeLiked by 1 person
Yes
LikeLike
Doug, this was exactly what I needed today! This is great workaround to the limitation of not being able to filter related lists. I combined this technique with Mass Action Scheduler, DLRS, and Component Visibility in Lightning App Builder to show a list of upcoming renewals on the Accounts page. Thank you for this fantastic solution!
LikeLiked by 1 person
Awesome! Happy to help, thanks for the kind feedback =)
You’re coming up with awesome solutions, I’ve been enjoying hearing about them.
LikeLike
Hey, so first of all this is great and than k you for all the hard work. I am having an issue where when I try to Mass Update or Data Import contact to auto-trigger the process on old contacts, I receive an error message:
Error:
The record couldn’t be saved because it failed to trigger a flow. A flow trigger failed to execute the flow with version ID 3011C000000Da28. Flow error messages: An unhandled fault has occurred in this flow
An unhandled fault has occurred while processing the flow. Please contact your system administrator for more information. Contact your administrator for help. No record updated
Did I mis-code the process or something else? Any help is greatly appreciated.
LikeLiked by 1 person
Error element myRule_3_A1 (FlowRecordUpdate).
This error occurred when the flow tried to update records: The flow failed to access the value for myVariable_current.Account.Id because it hasn’t been set or assigned.. For details, see API Exceptions.
This report lists the elements that the flow interview executed. The report is a beta feature.
We welcome your feedback on IdeaExchange.
Flow Details
Flow Name: Members_and_Other_Contact_Lookups
Type: Record Change Process
Version: 2
Status: Active
Flow Interview Details
Interview Label: Members_and_Other_Contact_Lookups-2_InterviewLabel
Current User: Andrew Olanow (00515000007KDc2)
Start time: 3/27/2018 8:35 AM
Duration: 0 seconds
How the Interview Started
Andrew Olanow (00515000007KDc2) started the flow interview.
Some of this flow’s variables were set when the interview started.
myVariable_old = 0031500001aOvfEAAS
myVariable_current = 0031500001aOvfEAAS
ASSIGNMENT: myVariable_waitStartTimeAssignment
{!myVariable_waitStartTimeVariable} Equals {!Flow.CurrentDateTime}
Result
{!myVariable_waitStartTimeVariable} = “3/27/2018 8:35 AM”
DECISION: myDecision
DECISION: myDecision2
Executed this outcome: myRule_3
Outcome conditions: and
1. {!myVariable_current.Active_Member__c} (false) Equals false
Logic: All conditions must be true (AND)
RECORD UPDATE: myRule_3_A1
Find all Contact records where:
Id Equals {!myVariable_current.Id} (0031500001aOvfEAAS)
Update the records’ field values.
Active_Member_Lookup__c = null
Other_Contact_Lookup__c = {!myVariable_current.Account.Id} (<myVariable_current.Account.Id couldn’t be resolved>)
Result
Failed to update records that meet the filter criteria.
Error Occurred: The flow failed to access the value for myVariable_current.Account.Id because it hasn’t been set or assigned.
Salesforce Error ID: 1447805567-330417 (-661354223)
LikeLiked by 1 person
Andrew, the last sentence in the error message tells you what caused the issue: “The flow failed to access the value for myVariable_current.Account.Id because it hasn’t been set or assigned”
What that means is the contact record 0031500001aOvfEAAS that caused the process/flow to fire did not have an Account populated because when the process/flow tried to access Account.Id it failed. The confusing error message “it hasn’t been set or assigned” means the field (in this case, Account.Id) was null / blank.
I would confirm that the contacts being tested have their AccountId populated and that nothing is blanking those fields.
LikeLike
Sorry for all these messages, but this is email error message I get when trying to Date Import to trigger process….
Error element myRule_1_A1 (FlowRecordUpdate).
This error occurred when the flow tried to update records: Too many SOQL queries: 101. For details, see API Exceptions.
This report lists the elements that the flow interview executed. The report is a beta feature.
We welcome your feedback on IdeaExchange.
Flow Details
Flow Name: Members_and_Other_Contact_Lookups
Type: Record Change Process
Version: 2
Status: Active
Flow Interview Details
Interview Label: Members_and_Other_Contact_Lookups-2_InterviewLabel
Current User: Andrew Olanow (00515000007KDc2)
Start time: 3/27/2018 8:58 AM
Duration: 1 seconds
How the Interview Started
Andrew Olanow (00515000007KDc2) started the flow interview.
Some of this flow’s variables were set when the interview started.
myVariable_old = 0031500001lOJi6AAG
myVariable_current = 0031500001lOJi6AAG
ASSIGNMENT: myVariable_waitStartTimeAssignment
{!myVariable_waitStartTimeVariable} Equals {!Flow.CurrentDateTime}
Result
{!myVariable_waitStartTimeVariable} = “3/27/2018 8:58 AM”
DECISION: myDecision
Executed this outcome: myRule_1
Outcome conditions: and
1. {!myVariable_current.Active_Member__c} (true) Equals true
Logic: All conditions must be true (AND)
RECORD UPDATE: myRule_1_A1
Find all Contact records where:
Id Equals {!myVariable_current.Id} (0031500001lOJi6AAG)
Update the records’ field values.
Active_Member_Lookup__c = {!myVariable_current.Account.Id} (0011500001SRZuCAAX)
Other_Contact_Lookup__c = null
Result
Failed to update records that meet the filter criteria.
Error Occurred: Too many SOQL queries: 101
LikeLiked by 1 person
Hi Andrew,
The specific error is the last sentence of the message: “Error Occurred: Too many SOQL queries: 101”.
This likely happens when there are too many workflow rules, processes, or triggers on an object OR the workflow rules, processes, or triggers on an object run queries or updates on too many records.
You can try reducing the batch size in Data Loader to see if the error will go away. Otherwise if the error persists then you will need to examine and make more efficient the workflow rules, processes, and triggers on the objects.
LikeLike
Hi Andrew,
When a process/flow fails, the first error email you get doesn’t really tell you anything other than “something broke”. It’s the other emails that you receive with it that detail the specific cause, which you’ve included as sub-comments below so that’s where my answers are too.
Thanks
LikeLike
Hi Douglas. I love this solution, but it doesn’t appear to work on Tasks. Do you have any thoughts on how to filter tasks associated with an account?
LikeLiked by 1 person
Hi Ken,
The solution works for Tasks, what specific issue are you running into? Please provide screen shots and description of what you’ve tried.
Thanks,
Doug
LikeLike