Hi all,
I'm trying to add multiple fixed filters to a detail on a booking record.
Master Record = UsrBooking
Detail = UsrPayments
I would like to show all payments linked to a booking where the account type (UsrPayments.UsrAccountType) = "Coach Company" (30091a3f-b9fd-43da-a39f-e0c59402a115)
i've added the below to the booking page schema (using Add fixed filter to detail | Community Creatio) but it overwrites the link to the booking and shows only 'coach company' payments for all bookings:
details: { "UsrCoachPaymentsDetailBooking": { "schemaName": "UsrCoachPaymentsDetail", "entitySchemaName": "UsrPayments", "filter": { "detailColumn": "UsrPaymentScheduleBooking", "masterColumn": "Id" }, "filterMethod": "getFilters" } methods: { getFilters: function() { var filters = new this.Terrasoft.createFilterGroup(); var AccountType = "Coach Company"; filters.add("FilterAccountType", this.Terrasoft.createColumnFilterWithParameter( this.Terrasoft.ComparisonType.EQUAL, "UsrAccountType.Name", AccountType)); return filters; } },
I would like to either:
- add the result of the getFilters function to the existing filter
- include the booking filter in the getFilters function
As a bonus, I'd also like to use the Id for the AccountType instead of the name (which may be subject to change).
Any assistance would be appreciated.
Like
Hi Cris,
The filtration you've created will return only UsrPayments records that have the UsrAccountType.Name = "Coach Company" and this result will be returned once the UsrPayments detail is loaded on the page. After that you can add additional filters manually. In case you need to use Id filtration you can modify the logic of the filter:
var accountTypeId = "some id here"; filters.add("FilterAccountTypeId", this.Terrasoft.createColumnFilterWithParameter(this.Terrasoft.ComparisonType.EQUAL, "UsrAccountType", accountTypeId));
getFilters method is executed initially once the detail is donwloaded to the page. Adding custom filters from the UI to this method won't be possible, so all initial filters that the record should have should be added to the getFilters method via the code.
Hi Cris,
The filtration you've created will return only UsrPayments records that have the UsrAccountType.Name = "Coach Company" and this result will be returned once the UsrPayments detail is loaded on the page. After that you can add additional filters manually. In case you need to use Id filtration you can modify the logic of the filter:
var accountTypeId = "some id here"; filters.add("FilterAccountTypeId", this.Terrasoft.createColumnFilterWithParameter(this.Terrasoft.ComparisonType.EQUAL, "UsrAccountType", accountTypeId));
getFilters method is executed initially once the detail is donwloaded to the page. Adding custom filters from the UI to this method won't be possible, so all initial filters that the record should have should be added to the getFilters method via the code.
Oleg Drobina,
Thanks Oleg, this has done the trick. I was able to add multiple filters with the following:
methods: { getFilters: function() { var filters = new this.Terrasoft.createFilterGroup(); var accountTypeId = "30091a3f-b9fd-43da-a39f-e0c59402a115"; var bookingId = this.get("Id") filters.add("FilterAccountTypeId", this.Terrasoft.createColumnFilterWithParameter(this.Terrasoft.ComparisonType.EQUAL, "UsrAccountType", accountTypeId)); filters.add("FilterBookingId", this.Terrasoft.createColumnFilterWithParameter(this.Terrasoft.ComparisonType.EQUAL, "UsrPaymentScheduleBooking", bookingId)); return filters; } },