Adding Additional Filters to a Detail Added From a Lookup in Creatio

If you have a detail in Creatio where items are added from a lookup using the LookupMultiAddMixin, by default, this adds a filter so once an item is added to the detail, it is filtered out of the lookup (preventing a user from adding it twice). However, you can also add additional filters to this as well if needed.

The LookupMultiAddMixin includes a function called getAllLookupFilters. This is the function where it applies the filter to exclude items already added. We can override this function and get the filters from the parent function, and then add additional filters to apply. Let’s say in our case, we’re adding products to a detail via a lookup. Let’s also filter out inactive products:

getAllLookupFilters: function() {
	var filters = this.mixins.LookupMultiAddMixin.getAllLookupFilters.apply(this, arguments);
				
	// exclude inactive products
	filters.add(Terrasoft.createColumnFilterWithParameter(
		Terrasoft.ComparisonType.NOT_EQUAL, "IsArchive", true));
				
	return filters;
}

In the code above, the first line we are calling the base getAllLookupFilters function from the LookupMultiAddMixin. Because this function is from a mixin, we can’t just call this.callParent, instead we must invoke the function from the mixin. We get the filters from that function, then add our own.

ABOUT THE AUTHOR

Ryan Farley

Ryan Farley is the Director of Development for Customer FX and creator of slxdeveloper.com. He's been blogging regularly about SalesLogix, now Infor CRM, since 2001 and believes in sharing with the community. His new passion for CRM is Creatio, formerly bpm'online. He loves C#, Javascript, web development, open source, and Linux. He also loves his hobby as an amateur filmmaker.

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe To Our Newsletter

Join our mailing list to receive the latest Infor CRM (Saleslogix) and Creatio (bpm'online) news and product updates!

You have Successfully Subscribed!