0

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:

  1. objects/Opportunity.object (Opportunity.PrimaryProduct__c) -- Error: Cannot update a filed to a Formula from something else
  2. 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.

1

It was my fault about running deployment with property checkOnly = true. This approach lets you just check if its possible to deploy your changes without actual deployment. In this case destructive changes make no impact on target org.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.