DB Dropdown fields on form are not populating correctly

Document ID : KB000013716
Last Modified Date : 14/02/2018
Show Technical Document Details
Introduction:

I have a dbcombo drop down list box on my custom form that is populated with a sql query to a separate table in my Harvest database containing the values for the list.  This way if the list changes I don't have to change and re-publish the form. 

Question:

On my test form I selected a value and saved the form.  Then I updated the table in my database to change the list.  The value I had selected before was no longer included.  When I re-opened my form the value I had previously selected was no longer visible.  Why did this happen?

Answer:

It looks like the forms were designed to work this way.  And, in a way it makes sense.  If the value selected before is no longer included in the drop down list then “technically” it’s an invalid value.  

What you could do is have an additional “read-only” field on your form to hold the selected value from the drop down list box.  Then, if the list changes, the value previously selected would still be visible.  You could populate the read-only field with java script using an a “field event” script (basically when a change happens in a field on your form, javascript can be executed to change another field accordingly).  Here’s a link where you can read more about this possibility: https://docops.ca.com/ca-harvest-scm/13-0/en/administrating/create-and-modify-form-types/how-forms-use-javascript-scripts#HowFormsUseJavaScriptScripts-UseFieldEventScripts

Additional Information:

As always, please contact CA Technologies support for CA Harvest Software Change Manager if you have further questions.