Represents the association between a Campaign and either a Lead or Contact.
Supported Calls
For API version
15.0 and earlier:create(), delete(), describeLayout(), describeSObjects(), getDeleted(), getUpdated(), query(), retrieve(), update(), upsert()
For API version
16.0 and later: upsert()
Special Access
Rules
Customer Portal users can't access this object.
Fields
| CampaignId |
- Type
- reference
- Properties
- Create, Filter, Group, Sort
- Description
- Required. ID of the Campaign to which this Lead or Contact is associated.
|
| ContactId |
- Type
- reference
- Properties
- Create, Filter, Group, Nillable, Sort
- Description
- Required. ID of the Contact who is associated with a Campaign.
|
| CurrencyIsoCode |
- Type
- picklist
- Properties
- Create, Defaulted on create, Filter, Nillable, Restricted picklist, Update
- Description
- Available only for organizations
with the multicurrency feature enabled. Contains the ISO code for
any currency allowed by the organization.
|
| FirstRespondedDate |
- Type
- date
- Properties
- Filter, Group, Nillable, Sort
- Description
- Indicates the date on which the campaign member was first given
a responded status.
|
| HasResponded |
- Type
- boolean
- Properties
- Defaulted on create, Filter, Group, Sort
- Description
- Indicates whether the campaign member has responded to the campaign
(true) or not (false). Label is Responded.
|
| LeadId |
- Type
- reference
- Properties
- Create, Filter, Group, Nillable,Sort
- Description
- Required. ID of the Lead who is associated with a Campaign.
|
| RecordTypeId |
- Type
- reference
- Properties
- Create, Filter, Nillable, Update
- Description
- ID of the record type assigned to this object. To change the record
type, modify the CampaignMemberRecordTypeId field
on the associated Campaign.
|
| Status |
- Type
- picklist
- Properties
- Create, Filter, Group, Nillable, Sort, Update
- Description
- Controls the HasResponded flag on this object. You can't directly set the HasResponded flag, as it is read-only, but you can set it indirectly
by setting this field in a create or update call. Each predefined
value implies a HasResponded flag value. Each time you update this field, you implicitly
update the HasResponded flag. In the Salesforce user
interface, Marketing users can define valid status values for the Status picklist. They can choose one status as the default
status. For each Status field value, they can
also select which values should be counted as “Responded,”
meaning that the HasResponded flag will be set to true for those values.
40 character limit.
When creating or
updating campaign members, use the text value for Status instead of the ID from the CampaignMemberStatus object.
|
If you are importing CampaignMember data into Salesforce and
need to set the value for an audit field, such as CreatedDate, contact Salesforce. Audit fields are automatically updated during API operations
unless you request to set these fields yourself..
Usage
Each record has a unique ID, and must
contain either a ContactId or a LeadId, but can't contain both. Any attempt to create a single
record with both results in a successful insert but only the ContactId will be inserted. However, you can create two separate
records on a Campaign—one for the Lead and one for the Contact.
Standard fields from a
Contact or
Lead are associated with the
CampaignMember object but you can’t query them directly. To include
a lead’s
Phone in your query, for example,
query the field from the
Lead object.
1SELECT Id, (SELECT Phone FROM Lead)
2FROM CampaignMember
This object is defined only
for those organizations that have the marketing feature and valid
marketing licenses. In addition, the object is accessible only to
those users that are enabled as marketing users. If the organization
does not have the marketing feature or valid marketing licenses, this
object does not appear in the describeGlobal() call, and you can't use describeSObjects() or query() with the CampaignMember object.
In
API version
16.0 and later, a
create() call only creates a new record; in earlier versions, a
create() call creates and updates records. The
API determines
whether a record exists with the specified
CampaignId and either
ContactId or
LeadId.
Only use a ContactId or LeadId, but not both, unless you want to track lead-based campaign
members you convert to contacts.
If the record does not exist
for the given
ContactId or
LeadId, then a new record is created. If the record exists,
an error is returned and no update is made. To update an existing
record, specify the ID of the
CampaignMember record to update.
In API versions
15.0 and earlier, if you submit multiple records using a single create
request, and if more than one record matches an existing record, only
the first record submitted updates the existing record. If any of
the submitted records match each other but do not match existing records,
only the last record submitted is created.
The upsert() call is not supported in API version
16.0 and later. To use the upsert() call on this object, you must first delete all data in ID fields
except the record ID.
To delete a record, specify the ID
of the CampaignMember record to delete.
When creating or updating records,
the Status field value specified in the call is verified as a valid
status for the given Campaign:
- If the specified Status value is a valid status, the value is updated, and the HasResponded field is updated to either true or false, depending
on the Status value association with HasResponded.
- If the specified Status value is not a valid status, the API assigns
the default status to the Status field and updates the HasResponded field with the associated value. However, if the given Campaign does not have a default status, the API assigns
the value specified in the call to the Status field, and the HasResponded field is set to false.