Added filter to detail with filterMethod but base filter no longer work
Hi,
I want to add a detail to the project page to show all activities associated with the project but only those with category = call.
I added the filterMethod to the detail on the projectPagev2 like this:
"UsrSchemae82228e2Detail99ddf41c": {
"schemaName": "UsrSchemae82228e2Detail",
"entitySchemaName": "Activity",
"filter": {
"detailColumn": "Project",
"masterColumn": "Id"
},
"filterMethod": "activityCallFilter"
}and created the activityCallFilter in the methods section
methods: {
activityCallFilter: function() {
var filterGroup = new this.Terrasoft.createFilterGroup();
filterGroup.logicalOperation = this.Terrasoft.LogicalOperatorType.AND;
filterGroup.add("CallFilter", this.Terrasoft.createColumnFilterWithParameter(
this.Terrasoft.ComparisonType.EQUAL, "ActivityCategory", "03df85bf-6b19-4dea-8463-d5d49b80bb28"));
return filterGroup;
},
}As a result I get only activities with category = Call but for ALL PROJECTS. no longer filtering to only current project.
When removing the added script I get a list of activities associated with the project but ALL categories.
How can I have both "base" filter and the custom filter?
Thanks,
Chani
Like
Hi Chani,
You have to extend Your method like this ...
activityCallFilter: function() {
var recordId = this.get("Id");
var filterGroup = new this.Terrasoft.createFilterGroup();
filterGroup.logicalOperation = this.Terrasoft.LogicalOperatorType.AND;
filterGroup.add("CallFilter", this.Terrasoft.createColumnFilterWithParameter(
this.Terrasoft.ComparisonType.EQUAL, "ActivityCategory", "03df85bf-6b19-4dea-8463-d5d49b80bb28"));
filterGroup.add("Project", this.Terrasoft.createColumnFilterWithParameter(
this.Terrasoft.ComparisonType.EQUAL, "Project", recordId));
return filterGroup;
}Best regards,
Marcin
Hi Chani,
You have to extend Your method like this ...
activityCallFilter: function() {
var recordId = this.get("Id");
var filterGroup = new this.Terrasoft.createFilterGroup();
filterGroup.logicalOperation = this.Terrasoft.LogicalOperatorType.AND;
filterGroup.add("CallFilter", this.Terrasoft.createColumnFilterWithParameter(
this.Terrasoft.ComparisonType.EQUAL, "ActivityCategory", "03df85bf-6b19-4dea-8463-d5d49b80bb28"));
filterGroup.add("Project", this.Terrasoft.createColumnFilterWithParameter(
this.Terrasoft.ComparisonType.EQUAL, "Project", recordId));
return filterGroup;
}Best regards,
Marcin
Marcin Kott,
So you say the filterMethod overrides the base filter, and the only way to achieve both is to have both in the function, don't you?
I added and it works but I thought there can be a nicer way :)
Thank you!