We have two custom fields:
- Opportunity.PrimaryProduct__c(lookup onto CustomObject__c)
- Opportunity.ProductFamily__c(lookup onto CustomObject__c)
Any of them don't being referenced from any place in code etc, just used for integration purposes. But I need to make those fields cross-object formulas like:
- PrimaryProduct__r.ProductName__c
- PrimaryProduct__r.ProductFamily__c
Regarding integration layout I have to keep the same API names for fields, so I use DestructiveChanges.xml (pre deploy) to remove lookups and create formulas during deployment. It looks like that:
<types>
<members>Opportunity.PrimaryProduct__c</members>
<members>Opportunity.ProductFamily__c</members>
<name>CustomField</name>
</types>
Deployment fails with the next error messages:
- objects/Opportunity.object (Opportunity.PrimaryProduct__c) -- Error: Cannot update a filed to a Formula from something else
- objects/Opportunity.object (Opportunity.ProductFamily__c) -- Error: Cannot update a filed to a Formula from something else
Please advice me how to convert fields from lookups to formulas.