🧪 Experimental KB — Official knowledge hub: community.kaptio.com

Duplicate field name error when creating Sales Invoices due to custom field namespace collision

Customer was unable to create Sales Invoices. The system was throwing a 'duplicate field' error during invoice generation.

sales-invoice custom-fields namespace managed-package field-naming

Problem

Customer was unable to create Sales Invoices. The system was throwing a ‘duplicate field’ error during invoice generation.

What We Found

The customer had created custom fields (CustomerComments__c and SupplierComments__c) on the Sales Invoice object with names that matched existing Kaptio managed package fields. When Salesforce processes fields within a managed package context, it automatically prepends the namespace (KaptioTravel__) to non-namespaced fields, causing them to collide with existing managed package fields.

Solution

  1. Identify the custom fields causing the conflict (in this case: CustomerComments__c and SupplierComments__c on the Sales Invoice object)
  2. Rename the custom fields to unique API names by adding a suffix (e.g., CustomerComments2__c, SupplierComments2__c) or a prefix (e.g., x_CustomerComments__c)
  3. Update any references to these fields in formulas, flows, reports, or integrations to use the new field names
  4. Test invoice generation to confirm the error is resolved

Notes

  • This is a known Salesforce 2GP (Second Generation Package) behavior - see Salesforce StackExchange for technical details
  • The issue can occur on any Kaptio object where customers create custom fields with names matching Kaptio managed package fields
  • Recommend testing in staging/sandbox environment first before making changes in production

Warnings

⚠️ When creating custom fields on Kaptio objects, always use unique names that don’t match existing Kaptio field names to avoid namespace collisions ⚠️ Renaming fields will break any existing references - ensure all formulas, flows, reports, and integrations are updated


Source: KHELP-12099

Was this article helpful?