Data in reference tables can differ across environments, which directly leads to have different primary key values of same reference data in the tables across environments. But, knowing this fact, still some Appian applications use primary keys of reference data as constant, for example primary keys of workflow statuses are referenced using constants rather than their text value. If while deploying or during data migration, primary key changes, then code written using those constant references may break.
What is the best approach to code for above use case?
Discussion posts and replies are publicly visible
First of all, you can try to keep the primary key of reference table data consistent across enviornment. This can be easily achieved by bit of discipline while developemnt and deployment process. Even then if you have doubt that Primary keys will not be consistent, you can have environment Specific constant so that values of these constants can be modified using properties file while deployment.