0

I need to send an email based of following

Case1: When campaign Member status = “Attended “ and campaign member type = “Contact” Then - send an email to campaign member’s account owner.

Case2: When campaign Member status = “Attended “ and campaign member type = “Lead”, Then - Send an email to lead owner.

I’m trying to achieve this declaratively using wf n process builder but it doesnt seem to work as campaign member type is not available declaratively.

I know i can achieve this by apex but don't want to - considering the 24hr single email limit.

Please suggest any best possible solution if i missed any.

Thanks in advance!

4
  • 1
    Please see How to Ask and post using edit what you've tried
    – cropredy
    Commented Jul 25, 2019 at 1:21
  • @cropredy - updated my question to outline what i’m trying to achieve. Pls suggest me the best way to handle this. Thanks
    – SMorse
    Commented Jul 25, 2019 at 1:32
  • 1
    CampaignbMember Type is not a field on that object - it is a convenience field used by reports/listviews. ContactId will be non null if member type = contact; leadId will be non null if member type = Lead. these fields are mutually exclusive
    – cropredy
    Commented Jul 25, 2019 at 1:41
  • @cropredy Thank you. I was able to add the process builder & made it to work with the following criteria AND( ([CampaignMember].ContactId) = null, TEXT([CampaignMember].Status) = "Attended", TEXT(PRIORVALUE([CampaignMember].Status)) <> "Attended" ) However when i tried it this way, it didn't work. AND( ISNULL([CampaignMember].ContactId), TEXT([CampaignMember].Status) = "Attended", TEXT(PRIORVALUE([CampaignMember].Status)) <> "Attended" ) Do you know the reason why?
    – SMorse
    Commented Jul 25, 2019 at 3:36

2 Answers 2

1

Your premise about how the choice of solution affects limit consumption is mistaken.

I know i can achieve this by apex but don't want to - considering the 24hr single email limit.

The email limit does not apply to email sent directly to your internal users:

If you use SingleEmailMessage to email your org’s internal users, specifying the user’s ID in setTargetObjectId means the email doesn’t count toward the daily limit. However, specifying internal users’ email addresses in setToAddresses means the email does count toward the limit.

Further, Process Builder Email Alerts are not free of limits:

The daily limit for emails sent through email alerts is 1,000 per standard Salesforce license per org—except for free Developer Edition and trial orgs, where the daily workflow email limit is 15. The overall org limit is 2,000,000. This limit applies to emails sent through email alerts in workflow rules, approval processes, flows, processes, or the REST API.

You can achieve the solution using either Process Builder or Apex. cropredy's comments should get you on the right track if you choose to apply Process Builder.

2
  • Thanks @David Reed . Was able to achieve this using PB with the following criteria AND( ([CampaignMember].ContactId) = null, TEXT([CampaignMember].Status) = "Attended", TEXT(PRIORVALUE([CampaignMember].Status)) <> "Attended" ) However when i tried it this way, it didn't work. AND( ISNULL([CampaignMember].ContactId), TEXT([CampaignMember].Status) = "Attended", TEXT(PRIORVALUE([CampaignMember].Status)) <> "Attended" ) Do you know the reason why?
    – SMorse
    Commented Jul 25, 2019 at 3:38
  • Just noticed that, we cannot send an email alert to Account Owner from Campaign Member, though the alert has the option to choose account owner, instead it sends email to campaign member owner which is a bummer. I guess apex is the only way for me to achieve my use case. success.salesforce.com/ideaView?id=08730000000DmB6AAK
    – SMorse
    Commented Jul 25, 2019 at 3:49
1

The field Campaign Member Type is not actually a field on the CampaignMember object - it is used as a convenience field in Reports and ListViews

However, CampaignMember.ContactId and CampaignMember.LeadId are fields on the object. These are required fields (but only one is present, not both, on any record).

As such, you can build PB decision blocks on whether the field is non-null and have the appropriate Email Action.

I note from your comment that sending to the Account Owner is not supported. You can vote up the Idea here to fix this. Workarounds would be:

  • Propagate the Account.Owner.Email to the Contact record in a custom Email field
  • Call invocable Apex to send the email alert
  • Use a Lightning Flow to send the email alert (invoked by the Process Builder)

You must log in to answer this question.

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