How do I setup a combo box that filters some records (like is_active = false). Yet still displays that value if you are looking at a historical record that was made when that static entity record was active.
I have made and aggregate and filtered for is_active = true. I used that as a source record list. This gives me a current list that is accurate. However when looking at historical records , they are blank if the static entity record is no longer active.
Is there an easy fix for this?
Instead of using an Aggregate and the ComboBox's "Source Record List" property to get the static entity records, just specify your static entity in the ComboBox's "Source Entity" property. The platform will then take care of that specific situation. That is, it won't display the inactive records when you're adding a new record, but will show them when you're editing an old record.
Hmmm... I did that originally and I thought it did not filter is_active = false records. I will try again.
Not sure if you will be able to read my screenshot but I did set it up the way you suggested and unfortunately it does not filter is_active = false. I am using the combo box inside an editable table. Maybe that is causing it to misbehave? Is there something else I could have setup wrong ?
You're right, it doesn't work as expected when the combobox is in an editable table.
I think your best alternative is, on your save action, to get the static record from the DB by Id and check if it's active. If it's not, you could cancel the save and show a message to the user.
I've been playing around with this and I think I found a better solution to this problem. Instead of describing it here in detail I'm just gonna attach an OML showing how I solved it. The basic idea is to check if it's a new or existing record and, based on that, show a filtered or unfiltered combobox.
Take a look and let me know if you need any help.
I will check it out. Thanks.