There are six filters in Gravity Forms Connect. Each does the same thing, but for the six different record types (contacts, organizations, projects, tasks, campaigns, opportunities) that are available in WP-CRM System.
These filters allow the user to determine if when updating a record if the categories should be appended to existing categories (default), or replace existing categories.
Each filter should return true (default) or false.
- true (default): Any time a record is updated, any new categories will be appended to any existing categories for the record. For example, if before a record is updated it is assigned to Category A and Category B, then the record is updated to include Category C, the record will result in being assigned to Category A, Category B, and Category C.
- false: Any time a record is updated, the existing categories will be replaced with the new categories. For example, if before a record is updated it is assigned to Category A and Category B, then the record is updated to include Category C, the record will result in being assigned to just Category C.
You might find the following use cases helpful in determining which is appropriate for your usage.
If you are categorizing a contact based on their interests from the lead generation form they fill out, you may not want to lose the prior interests. Originally they fill out a form, which categorizes them as interested in “Graphic Design”. The form will then add them to the “Graphic Design” category. Subsequently, they fill out another form that categorizes them as interested in “Content Writing Services”. The form will then add them to the “Content Writing Services” category, and keep them in the original “Graphic Design” category. In this case you would leave the filter to return true, which is the default value, so nothing needs to be done with the filter.
If you have projects that are only assigned to one category at a time and they could possibly change scope in the future, it might make sense for any updates to the project through a form to replace the existing category. Originally a form is submitted that created a project in the “Logo Design” category. Subsequently, the form is submitted again and the scope changed to “Brand Consulting”, and the project should no longer be in the “Logo Design” category. In this case you would want the project filter to return false, which can be done like this:
add_filter( 'wp_crm_system_gravity_forms_append_project_categories', '__return_false' );
Note that each filter listed above can be used in the same way by changing the first parameter in the add_filter() function.