The Salesforce Developers website will undergo maintenance on May 29, 2024 from 3:00 a.m. UTC to 10:00 a.m. UTC. The maintenance process may affect the availability of our documentation. Please plan accordingly.

Campaign Object

An Account Engagement campaign tracks the first interaction that a person has with your online marketing materials. Associate your assets to an Account Engagement campaign to organize and track your marketing efforts. Learn more about Account Engagement campaigns in Salesforce Help.

Include the authentication header with every request. For information on how to authenticate, see Authentication.

Resource NameOperationsDescription
Campaign CreatePOSTCreate a campaign record.
Campaign ReadGETRequest information for a single campaign.
Campaign QueryGETRequest information for the campaigns that match the specified criteria.
Campaign UpdatePOSTUpdate a campaign's information, including campaign fields.

Note: We recommend using Salesforce Connected Campaigns. When Connected Campaigns is enabled, only Campaign Read and Campaign Query are available.

Create a campaign with the specified fields.

You can use any campaign field as a parameter. For a list of campaign fields, see Campaign.

Create a campaign with the name New Campaign and a cost of 2,000.

Request information for a single campaign.

Replace <ID> with the Account Engagement ID of the campaign.

Request information for the campaign with ID 12341xxx.

Request information about the campaigns that match the specified criteria. You can specify which campaigns and which fields to request. A maximum of 200 campaigns are returned, unless you specify the output as mobile. If you specify the output as mobile, then all campaigns are returned.

Note: To request information about a specific campaign, use Campaign Read.

Use these parameters to specify which campaigns are returned. Parameters can be used in any combination and in any order unless otherwise specified.

Notes:

ParameterTypePossible ValuesDescription
created_afterstringtoday, yesterday, last_7_days, this_month, last_month,<custom_time>Request campaigns created after the specified date and time. Example: To request forms created in 2020, use /api/campaigns/version/3/do/query?created_after=2019-12-31 24:59:59.
created_beforestringtoday, yesterday, last_7_days, this_month, last_month, <custom_time>Request campaigns created before the specified date and time. Doesn’t include campaigns created at the specified time. <custom_time> Example: to request campaigns created before today (but not created today), use /api/campaign/version/3/do/query?created_before=today.
id_greater_thanintegerAny positive integerRequest campaigns that have an Account Engagement ID greater than the specified number.
id_less_thanintegerAny positive integerReturns campaigns that have an Account Engagement ID less than the specified number.
namestringstringRequest campaigns with the specified name.
updated_afterstringtoday, yesterday, last_7_days, this_month, last_month, <custom_time>Request campaigns that were last updated after the specified date and time.
updated_beforestringtoday, yesterday, last_7_days, this_month, last_month, <custom_time>Request campaigns that were last updated before the specified date and time.

Use these parameters to specify which campaign fields are returned, and how the campaigns are sorted.

ParameterTypePossible ValuesDescription
limitintegerAny integer from 1 through 200.The number of campaigns to return. Default value is 200.
offsetintegerAny positive integerThe number of campaigns to omit from the response (the number to "skip over"). Example: Retrieve a list of campaigns, omitting the 50 most recently updated campaigns. Sort the query by the updated_at field and use offset=50: api/campaign/version/3/do/query?sort_by=updated_at&offset=50
sort_bystringcreated_at, id, name, updated_at,costThe field by which the results are sorted. See Sort Order.
sort_orderstringascending, descendingThe sort order. The default value depends on which sort_by value you specify. See Sort Order.

Use sort_by to specify which field Account Engagement uses to sort the results. Different fields have different default sort orders.

ValueDefault Sort OrderDescription
created_atdescendingSort the results by the campaigns' created_at timestamps.
idascendingSort the results by the campaigns' id fields.
nameascendingSort the results by the campaigns' name fields.
updated_atdescendingSort the results by the campaigns' updated_at timestamps.
costdescendingSort the results by the campaigns' cost fields.

Request a list of campaigns, sorted in ascending order by cost.

Update a campaign's information, including campaign fields. Fields that aren’t specified in the request aren’t changed. To clear a field, use a null value.

Returns an updated version of the campaign.

Replace <ID> with the Account Engagement ID of the campaign.

You can use any campaign field as a parameter. For a list of campaign fields, see Object Field References.

To update a campaign's name to "March Webinar" and reset the cost as blank, use the following POST command:

The XML response for a query request contains information about multiple campaigns. The XML response for a read request contains information about a single campaign.

TagDescription
<result>Parent tag. Contains the campaigns that match the parameters specified in your query.
<total_results>The number of campaigns selected by the query. Note: The query request returns a maximum of 200 campaigns. If your query matches more than 200 campaigns, you can make several requests to retrieve all matching records.
<campaign>The information for a single campaign. For information about campaign fields, see Campaign.
TagDescription
<campaign>The information for a single campaign. For information about campaign fields, see Campaign.