
In my previous article, I wrote about how to filter a lookup using an attribute that allowed you to set the lookup filters in code, rather than with a business rule. In this article we’ll look at a specific example of filtering a contact lookup to only display contacts that are users in a certain role.
Here’s the code to add to the attributes. In our example, we are filtering a contact lookup with a column name of UsrApprovalUser and we only want to see contacts in the lookup that are in the “Sales managers” role:
attributes: { "UsrApprovalUser": { "dataValueType": Terrasoft.DataValueType.LOOKUP, "lookupListConfig": { "filters": [function() { var filters = Ext.create("Terrasoft.FilterGroup"); filters.add("RoleFilter", Terrasoft.createColumnFilterWithParameter( Terrasoft.ComparisonType.EQUAL, "[SysAdminUnit:Contact].[SysUserInRole:SysUser].SysRole.Name", "Sales managers" ) ); return filters; }] } } }
That’s it. Add that attribute to the page and the lookup will now be filtered.
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!