Choices for a field are missing or deleted choices are shown when applying remote changes for an application


Description

Applying remote changes for an application inserts a deleted choice and doesn't load actual choices for a field

Steps to Reproduce

1. Create a scoped application
2. Add a table with a choice field.
3. Add few choices to the field.
4. Delete the choices that were added to the field.

Scenario1:
a) Commit the application to source control
b) Apply remote changes
Expected: No choices are present for the field
Actual: One of the deleted choices is present for the field.

Scenario2:
a) Add few new choices to the field.
b) Commit the application to source control
c) Apply remote changes
Expected: Choices created in step a) should be present for the field.
Actual: One of the deleted choices is present and the new choices created in step a) are missing for the field.

Workaround

Inactivate the choices instead of deleting them.


Related Problem: PRB1402405