Filtering a Contact Lookup to Only Display Users in a Certain Role in Creatio (formerly bpm’online)

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.

Want content like this delivered to your inbox? Sign up for our newsletter!
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 *