Start a conversation

CloudSense Order Generation Apex Job Fails with <code>FIELD_FILTER_VALIDATION_EXCEPTION</code> on <code>Customer_Primary_Contact__c</code>

Contents

Overview

During CloudSense order generation, an Apex job can fail due to a Salesforce lookup/filter validation error on the custom field Customer_Primary_Contact__c. In many cases, the full exception is not visible in the UI because the failure occurs within a managed package execution context, so the detailed error must be confirmed in Salesforce debug logs.

This is a data/validation and configuration issue in the org: the value being set on Customer_Primary_Contact__c does not exist and/or does not meet the lookup filter criteria. Even if the stack trace points to a managed trigger, the invalid field value can be introduced by customer automation (custom triggers, workflows, flows) running in the same transaction. No product defect or fixed version was identified.

Solution

Error message (exact)

System.DmlException: Update failed. First exception on row 3 with id <record_id>; first error: FIELD_FILTER_VALIDATION_EXCEPTION, Value does not exist or does not match filter criteria.: [Customer_Primary_Contact__c]

Symptoms / impact

  • CloudSense order generation Apex job fails.
  • The UI may not display the complete exception details when the failure occurs within a managed package context.

What this error means

Salesforce rejected an update because Customer_Primary_Contact__c is subject to lookup/filter validation, and the value being set:

  • does not exist, and/or
  • does not match the field’s configured lookup filter criteria.

Even if the stack trace indicates the DML is initiated from a managed trigger, the invalid value can be introduced by other automation in the same transaction (custom triggers, workflows, flows).

Recommended investigation approach

  1. Reproduce the failure on the affected order record

    • If applicable to your scenario, clear csordtelcoa__Order_Generation_Batch_Job_Id__c (set to blank/none) and re-run order generation to reproduce the failing job.
  2. Retrieve the complete exception details from Salesforce debug logs

    • Identify the first failing validation: FIELD_FILTER_VALIDATION_EXCEPTION on Customer_Primary_Contact__c.
    • Note the impacted record id shown in the exception: <record_id>.

Resolution (mitigation)

1) Validate the failing record and field value

  1. Open the record referenced in the exception: <record_id>.
  2. Inspect Customer_Primary_Contact__c:
    • Confirm the referenced value exists (for lookup fields).
    • Confirm the selected value satisfies any configured lookup filter criteria.

2) Review lookup filter criteria for Customer_Primary_Contact__c

  • Open the field definition for Customer_Primary_Contact__c and review its lookup filter criteria.
  • Confirm the “primary contact” values you expect to use can pass the filter.
  • If the filter is overly restrictive, update it to align with the intended business rules.

3) Check for custom automation that updates Customer_Primary_Contact__c

Because the transaction may include customer automation, review any logic that could be setting Customer_Primary_Contact__c during order generation:

  • Custom Apex triggers
  • Workflow Rules / Process Builder (if applicable)
  • Flows

Confirm none of these are setting Customer_Primary_Contact__c to a value that violates the lookup filter criteria or references a non-existent record.

Verification

  1. After correcting the field value and/or updating the lookup filter and automation logic, re-run the CloudSense order generation process on a test record.
  2. Confirm the Apex job completes successfully and the exception above no longer appears in the logs.

Frequently Asked Questions

1. How do I know this is the same issue?

Check Salesforce debug logs for an exception containing FIELD_FILTER_VALIDATION_EXCEPTION that specifically references [Customer_Primary_Contact__c], often in the form:

System.DmlException: Update failed… first error: FIELD_FILTER_VALIDATION_EXCEPTION… [Customer_Primary_Contact__c]
2. The error references a managed trigger—does that mean the managed package is setting Customer_Primary_Contact__c?

Not necessarily. The DML may be initiated from managed logic, but the invalid value can also be introduced by custom triggers/workflows/flows that run in the same transaction and update Customer_Primary_Contact__c.

3. What should I check first: the record value or the lookup filter?

Check both: verify the value on the impacted record (<record_id>) is valid and then confirm the lookup filter criteria on Customer_Primary_Contact__c allows that value. Either an incorrect value or an overly restrictive filter can cause the validation failure.

4. What if the job still fails after fixing Customer_Primary_Contact__c?

Re-check the logs for the next “first error” after the initial validation is resolved, and review any custom automation that might still be updating Customer_Primary_Contact__c (or other validated fields) during order generation.

Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. Matej Storga

  2. Posted

Comments