Data Deployment Error: REQUIRED_FIELD_MISSING:Required fields are missing: <object>:<field>
"REQUIRED_FIELD_MISSING:Required fields are missing: [Pricebook2Id]:Pricebook2Id --"
This error occurs for various reasons:
- A required lookup field (parent object) is missing from the data template.
- Some implementations, such as Salesforce CPQ, expect certain child records to be inserted before certain fields on the parent record are populated. The error is stating that the child field doesn't exist yet.
- When using the upsert method with one external Id field formally defined as a Salesforce external Id, Copado executes an actual Salesforce upsert call. But Salesforce upsert calls exclude required fields (to avoid potential update errors), hence this missing field error. For example, Price Book Entry has a master-detail relationship with Product. Salesforce has an option to either allow or disallow the re-homing of a master record (Products, in this case). Salesforce CPQ has chosen disallow for Price Book Entry. So, when you move a Price Book Entry record from one org to another, it essentially needs to assign the price book entry to another product, which is not allowed.
- Correct permissions are not set on the destination record.
- The parent record of the record that contains the field failed to deploy.
- In the template editor, navigate to the Parent Objects tab, select the parent object that matches the field in the error message.
- In the Fall '17's release, disable Salesforce CPQ triggers in the destination org. Then, turn the triggers back on after the deployment completes. Starting with the Winter '18's release, use the Delay on Insert and Deploy Last field properties to better control the migration order.
- You will need to recreate price book records using an Apex anonymous script.
- Ensure that all permissions, including field-level access, exist for the field both in the source and destination organizations.
- Check previous batch results for deployment failures of the parent record. Ensure that the parent record successfully deploys.