Phase Id Field Has Become Unique - "Duplicate key violation"

Hi,

I'm unable to create multiple records in a custom record due to a "Duplicate key violation" error on the "Phase Id" field, which appears to be enforcing uniqueness unexpectedly.

The exact error that's displayed is "Duplicate key violation: field name 'Phase Id'".

This is how I set up the custom record:

1. Created the custom record and set the unique identifier to a new SMALL_TEXT field I called "CatalogNumber_c".

2. Created the rest of the fields, added them to the forms, and created the workflow with 2 metaphases: "Active" and "Inactive". I also created "Active" as the starting phase.

3. After creating the workflow, I usually add an "Inactive" normal phase, connect it to the "Active" phase, and move it to the "Inactive" Metaphase.
    This time, however, I forgot to do so and only had 1 "Active" normal phase and nothing in the "Inactive" metaphase.

4. Created 2 Business rules, one is a filter in "Rendering Forms", and the other is a "Set field" rule meant to concatenate different values from fields to create a DisplayLabel. None of these rules referenced "Phase Id".

4. Activated the Custom Record using the Studio Menu.

5. Created 1 record by hand and made sure that it was created successfully.

6. Using a CSV file to import more records - The import failed, and this is when I discovered the problem in the errors JSON file.

In order to troubleshoot this, I've tried:

  • Deactivating/Activating the custom record
  • Deleting and re-adding the phases
  • Creating the records with the GUI and REST API
  • Exporting and importing the package of that specific custom record

None of the above steps fixed it, so any help is appreciated.

Thank you

  • Verified Answer

    +1

    Update:

    After extensive testing, I believe I've pin-pointed the problem.

    It seems to be related to a package I had previously imported from another tenant. The package contained an application which contained a custom record with the same name as the one I was trying to create - but I removed that record from the package in order to re-create it.

    Although I didn't export that specific record to the package, I suspect the package may have retained some metadata about it.

    This could explain why creating a new custom record with the same name resulted in the "duplicate key violation" errors.

    If this theory is correct, the issue isn't with the Phase Id configuration itself, but rather with a potential conflict between the imported package metadata and my new custom record creation.

    For the time being, I've created the same record but with a slightly different name in order to avoid this problem. I hope this issue was already fixed in future versions.

  • 0   in reply to 

    Hi Avi,

    I did try to reproduce the same problem you were having however, I was unable to do so. Everything was able to import correctly via the CSV import step. If I tried to re-import the same csv I got the Duplicate key violation: field name 'Catalog Number' but that is to be expected based upon the catalog number is acting as the unique identifier and I'm trying to load a value that already exists. At no stage do I get anything related to Phase Id.

    So it makes sense if you happened to have some form of corruption with the Record that you were trying to use.

  • 0 in reply to   

    Hi Dave,

    Thank you for trying to verify the problem - I should've clarified that after checking more thoroughly that the steps in my original posts are not likely to have an effect on this issue. I reproduced the bug with the original package I created but couldn't reproduce it with a "fresh" one, which also hints the record could have been corrupted or there might be other factors at play that I haven't identified.

    For context, here are the steps I took with the original problematic package:

    1. Created an application containing multiple custom records in the source tenant
    2. Created a package, deliberately de-selecting one of the custom records
    3. Imported this package to a different tenant
    4. Attempted to recreate the de-selected custom record with the exact same name within the imported application

    I also noticed something interesting about the error messages:

    • When DisplayLabel was set as the unique identifier, the error mentioned "Process Id"
    • When a custom field was set as the unique identifier, the error mentioned "Phase Id"