CampaignMember

Represents the association between a Campaign and either a Lead or Contact.

Supported Calls

create(), update(), delete(), describeSObjects(), query(), retrieve(), getDeleted(), getUpdated()

API version 16.0 and later: upsert()

Special Access Rules

Customer Portal users cannot access this object.

Fields

Field Field Type Field Properties Description
CampaignId reference Create

Filter

Required. ID of the Campaign to which this Lead or Contact is associated. For information on IDs, see ID Field Type.
ContactId reference Create

Filter

Nillable

Required. ID of the Contact who is associated with a Campaign.
CurrencyIsoCode picklist Create

Defaulted on create

Filter

Nillable

Restricted picklist

Update

Available only for organizations with the multicurrency feature enabled. Contains the ISO code for any currency allowed by the organization.
FirstRespondedDate date Filter

Nillable

Indicates the date on which the campaign member was first given a responded status.
HasResponded boolean Defaulted on create

Filter

Indicates whether the campaign member has responded to the campaign (true) or not (false). Label is Responded.
LeadId reference Create

Filter

Nillable

Required. ID of the Lead who is associated with a Campaign.
RecordTypeId reference Filter

Nillable

ID of the record type assigned to this object. To change the record type, modify the CampaignMemberRecordTypeId field on the associated Campaign.
Status picklist Create

Filter

Nillable

Update

Controls the HasResponded flag on this object. You cannot 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.com 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.

Note
If you are importing CampaignMember data into Salesforce.com and need to set the value for an audit field, such as CreatedDate, contact salesforce.com. Audit fields are automatically updated during API operations unless you request to set these fields yourself. For more information, see System Fields.

Usage

Each record has a unique ID, and must contain either a ContactId or a LeadId, but cannot 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.

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 cannot 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.
Note
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 create() is performed. If the record exists, an error is returned and no update is made. To update an existing record, use the update() call and 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() call, 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.

To create and update records at the same time in API version 16.0 and later, use the upsert() call; in earlier API versions, the upsert() call is not supported. 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, use the delete() call and specify the ID of the CampaignMember record to delete.

During a create() or update() call, the Status field value specified in the call is verified as a valid status for the given Campaign:

© Copyright 2000-2009 salesforce.com, inc. All rights reserved.
Various trademarks held by their respective owners.