How to filter on individual detail rows?


Say there are fields on a detail UsrAccount and UsrIsOurAccount (these are arbitrary fields). If UsrIsOurAccount is checked I want to apply a filter to UsrAccount to be only our Accounts. How would I apply this kind of logic to individual rows in a detail?

Thanks in advance.


Like 0



Hello Tyler, 


Please refer to this posts where similar questions were asked.


Please use these articles I've mentioned in order  to resolve your business task.


Best Regards, 


Bogdan L.

Bogdan Lesyk,


Neither of these articles cover a conditional filter on specific rows of a detail.


It's possible to do it in the following way:

1.  You need to create additional column Our Account of boolean type on the Account section to make sure which accounts are yours.
2.  Create Detail with editable list on the Contact edit page with such columns: UsrLsOurAccount (Boolean), UsrAccount (Lookup that refers to Account lookup), UsrContact (Lookup that refers to Contact lookup) and Name(text).
3.  On the DetailPage please add filter to UsrAccount which will show only your Accounts in case the UsrLsOurAccount checkbox is filled by user on the detail. Please find the example code on the attached picture. 

Best Regards,
Tetiana Bakai

Hi Tyler,

I assume you have an editable detail and you want to filter a lookup in the detail rows based on another value in that same detail row. Did I understand that correctly? 

If you put the code to filter the lookup on the page, not the detail, it will be used in the detail rows as well. Also, in the filter method, you can read other values for the record using this.get("Field") etc to now how to construct the filter. 

As an example, something like this code would be added to the page (but from what you described, sounds like you could also just use a business rule as well):

attributes: {
  "UsrAccount": {
    "dataValueType": Terrasoft.DataValueType.LOOKUP,
      "lookupListConfig": {
        "filters": [function() {
          // read value from current record
          var isOurAccount = this.get("UsrIsOurAccount");
          var filters = Ext.create("Terrasoft.FilterGroup");
          // conditionally apply filter
            if (isOurAccount) {
                  Terrasoft.ComparisonType.EQUAL, "Type", "Out company"
            return filters;

Hope this helps


Show all comments