By Chris Malek | 14 September 2011
Component Interface EditHistoryItems Gotcha
When you are writing code against a Component Interface API, there is an important boolean property on the CI called EditHistoryItems. Because a Component Interface will mimic the online logic as if a user were actually keying the data into the page there is a direct relationship between the Component Interface EditHistoryItems property and the “correct history mode” in the online component accessed via a web browser.
When you set “EditHistoryItems = True”, that is the same as entering a component in “Correct History.” This only really matters for components that have and EFFDT field as part of one of the records keys. If EFFDT is not part of the key structure then, correction history/editHistoryItems serves no purpose.
If you have EFFDT in they key structure and you enter a component in “Correct History” mode, it will allow you to change data that is dated in the past. Hence, the “correct history” nomenclature. If you try to correct past data and you are not in correct history mode, you will see an error in your web browser and the data will not be saved.
This is not the behaviour when working with Component Interface. If your programmatic code tries to correct some history in the CI and you set EditHistoryItems = False, it will fail silently trying to update the field property. So let’s say your code tries to make a change to some historical value on a field/CI property called DESCR and EditHistoryItems = False. The CI will just not take the value. I have seen that it just “silently” fails with no indication that you tried to correct history but where not in the correct mode.
I have seen this behaviour on 8.50. So make sure you do some testing in your code to determine if your code should be in correct history/editHistoryMode. It really depends on what your code is trying to do. Generally, it is frowned upon to update history but there are exceptions to this.