Loading

Lead Assignment Rules do not evaluate Campaign fields when creating Leads via UI, REST API, or Apex

게시 일자: Jun 14, 2026
상세 설명

When a Lead Assignment Rule contains criteria based on Campaign fields (for example, Campaign: Type equals Advertisement), the rule is not triggered when a Lead is created through Lightning Experience, REST API, Apex, or the Data Import Wizard. This is expected behavior due to the architecture of the Lead-Campaign relationship in Salesforce.

솔루션

Campaign is not a native field on the Lead object. Campaign membership is stored in CampaignMember records, which represent a many-to-many relationship between Leads and Campaigns. Lead Assignment Rules evaluate only fields available directly on the Lead record at rule execution time.

For Leads created via UI, REST API, or Apex, Campaign cannot be set on the Lead during creation. Subsequent rule re-evaluations also lack Campaign context because there is no CampaignId lookup field on the Lead object.

The only supported path that passes Campaign context at create time is the SOAP API, which includes a Campaign_Id parameter, or Leads created through Web-to-Lead.

 

Other ways that Leads can be assigned by Campaign association:

  1. Use SOAP API for Campaign-aware routing: If Leads must be routed by Campaign at creation time, use the SOAP API and pass the Campaign_Id parameter so the assignment rule can evaluate it.
  2. Post-create Flow or Apex routing: After a CampaignMember record is created, use a Flow or Apex trigger to query related Campaigns and assign Lead ownership based on Campaign attributes.
  3. Custom proxy field approach: Create a custom field on the Lead (e.g., a text or lookup field) that is populated by automation from CampaignMember context. Base assignment rule criteria on that custom field instead of the native Campaign field.
Knowledge 기사 번호

005386895

 
로드 중
Salesforce Help | Article