7

I am migrating objects from one org to another using the ant migration tool and came across the following error.

Custom Field Definition ID: bad value for restricted picklist field: RecordType

I thought it would be because I had picklist fields in the record type definition that didn't exist, but I doubled checked my object model and it seems fine (took out 3rd party dependencies). Any idea what other reasons this might pop up due to?

UPDATE: I had pulled down the XML from the Force IDE, and apparently picklist values for each Account and Opportunity had converted a "/" to "%2F" and "," to "%2C" in the picklist definitions in the record type section. The field picklist values remained fine with the "/" or ",". Unfortunately, still getting the error. Wondering if I just have to manually audit all of the record type picklist values against the field definition in the XML :(

2
  • Can you just try migrating the object causing issue using changeset.Here is an example how this issue was resolved boards.developerforce.com/t5/General-Development/… Commented Jul 1, 2013 at 18:54
  • Somehow I got past it in my debugging attempts by only picking 1 record type and 1 value in each picklist, and then once it was in uncommenting the rest and it went in fine. I still don't know what the actual issue was though... Commented Jul 1, 2013 at 21:14

5 Answers 5

6

I have the same error for scratch orgs on some standard objects (Account, Contact, Lead, and Opportunity).

As a workaround, I found that after removing "recordTypeTrackHistory" from the object metadata file or setting the value to false then the deployment succeeded.

5
  • This one helped me. It seems you can't submit an object metadata file that doesn't currently had Record Types defined in the org and the new file includes both adding records types and the object flag <recordTypeTrackHistory>true</recordTypeTrackHistory>. Not a problem for most orgs and processes but comes up in Scratch Orgs during build cycles. Added a single record type first then set the flag to true in a separate deployment. Commented Jun 30, 2021 at 19:23
  • 1
    This is unfortunately still an issue on Summer '22, and this fix worked for my project. I wish it was possible to have SFDX ignore certain settings or have git ignore lines that match a certain regex. Commented Jul 22, 2022 at 3:12
  • We do it with a pre-processing script that comments out certain 'problematic' metadata only for deploying to scratch orgs
    – sskular
    Commented Mar 15, 2023 at 16:28
  • still an issue in summer '23
    – Json
    Commented Jun 11, 2023 at 12:31
  • I encountered this issue on spring 24. Removing the line makes it work !
    – FabienHuot
    Commented Mar 22 at 9:16
3

I had pulled down the XML from the Force IDE, and apparently picklist values for each Account and Opportunity had converted a "/" to "%2F" and "," to "%2C" in the picklist definitions in the record type section. The field picklist values remained fine with the "/" or ",". Unfortunately, still getting the error. Wondering if I just have to manually audit all of the record type picklist values against the field definition in the XML :(

1

@Michael Welburn I was doing a similar migration and ran into this error. Way I resolved it is much different and I am not sure if thats the best solution, still wanted to share my approach so that others can benefit.

I was trying to deploy Lead object(along with business process, record types etc) from one SFDC instance to another and got this error. To resolve this, I did create one dummy business process in the target sfdc instance and then tried to deploy my ANT package and it worked fine. Before creating business process manually i did the xml file for my lead object and it didnt had any special characters that might cause issues.

Hope it helps.

1

We had the same issue while deploying to a sandbox

Custom Field Definition ID: bad value for restricted picklist field: RecordType

Whe had some picklist values that contains "/" but even when I deleted those value, I was still got the error

I applied the following workaround : manually creating the record types in the dest sandbox then deploying the rest using the Metadata API

0

I think you may have accidentally mapped a field twice in the Salesforce connector. Check through your field mappings to be sure that each field is only mapped once. In this case, I can recommend you two solutions that might solve your problem.

  1. deleting and remapping the picklist that is causing the error
  2. unchecking the “restrict picklist” checkbox in the field settings, you may be able to circumvent this type of error let me know if it helps and upvote it. Thanks

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .