0

I have a scenario where I have to roll up the count of active campaigns that a contact is enrolled in.

To achieve this, I tried to create a master-detail on the Campaign Member to the contact. But I am not able to find this data type option when creating a new field.

I first assumed its because of existing data. But then I deleted all the data in Dev Sandbox and I still don't see the option.

What am I missing in this scenario? Is it not possible to create a Master-Detail for Standard objects?

Thanks in advance.

1 Answer 1

1

You cannot really create a M-D relationship between standard objects. Even though it is not explicitly mentioned, but if you see this note from the documentation, standard objects cannot be on detail side (of custom and that of any standard object either) and that kind of says it.

You can define master-detail relationships between custom objects or between a custom object and a standard object. However, the standard object cannot be on the detail side of a relationship with a custom object. In addition, you cannot create a master-detail relationship in which the User or Lead objects are the master.

The option of creating a M-D is not available on any of the standard objects in Salesforce when you create a field and only on custom objects because of this fact. I also came across this idea to allow M-D between standard objects.

What you need here is a bit of customization either using process builder or apex triggers to be able to roll up the counts of contacts on the campaign member.

3
  • 1
    Inasmuch as it's rolling up across a junction object based on criteria on the other parent, it sounds to me like a Scheduled Rollup with DLRS might be the best solution (otherwise you end up maintaining two triggers, I think?)
    – David Reed
    Commented May 9, 2018 at 18:47
  • @DavidReed Yeah, I would think so. Need to research a bit on the most viable solution option. But definitely it ends up not straight out of the box as with rollup summaries.
    – Jayant Das
    Commented May 9, 2018 at 18:50
  • In my opinion, the Contact - CampaignMember link should have been a master-detail by default rather than a lookup. The batch looks like the only viable solution, but at the cost of being not real-time. Thank you JayantDas and @DavidReed for your inputs. Commented May 9, 2018 at 20:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .