The campaign member object in Salesforce represents the association between a campaign and a lead or a contact. While some standard lead and contact fields are available for the campaign member object, if you want to view or pull a report for custom fields, you will need to create a new field. This post will show you how to create a formula field on the campaign member object that will pull in the custom field value for a lead or a contact.
Create a formula field
Create a formula field on the campaign member object that will check if the campaign member is a Lead or a Contact and populate the field with the custom field value.
Navigate to the campaign member object within the object manager and create a new formula field.
If your lead and contact fields are picklists, use this syntax for the formula.
1 |
IF(ISBLANK(ContactId), TEXT(Lead.Status), TEXT(Contact.Status__c)) |
If your lead and contact fields are not picklists, use this syntax for the formula.
1 |
IF(ISBLANK(ContactId), Lead.Status, Contact.Status__c) |
Add the field to campaign member related list
You can add the new custom field to the campaign member related list by navigating to the campaign object in the campaign manager and selecting your page layout. Scroll to the campaign member related list and click on the wrench icon to select your fields.
Now the custom field displays in the related list for campaign members.
Use the fields within reports
The custom field is also available within the campaigns with campaign members report.
Questions?
Send me a tweet @jennamolby, or leave a comment
Hi Jenna,
Thank you for the great article. I did created a custom field to display lead/contact information which was really helpful. I do have a question – is it possible to filter the custom field in the list view campaign members? It did not show in the filter when I click the “funnel icon”. Could it be because it is a formula field? It would be great if it display in the filter selection.
Hi Yvonne, You’re welcome! I did some research and I don’t think it’s possible to add it as a filter to the campaign members view.
Hello Jenna,
Thanks so much for this awesome article – I just have a quick question. The Contact Status field you are referring to in your formula is a custom field. Does that mean there is an assumption that that field was created earlier and the Lead Status was mapped into that?
Many thanks,
Claudia
Hi Claudia, You’re welcome! The lead and the contact fields do not need to be mapped in order for this to work.