Question

Show only active users in case assignee dropdown

Hi Community,

 

In "Case" we wanted to filter "assignee field". Currently all users are showing in the dropdown both active and inactive. Using business rule how we can filter it to show only active users? Thank you

 

 

 

Like 1

Like

3 comments

Hi Fulgen,



1. You have to set filter in the Case page:

           

"Owner": {

                "dataValueType": Terrasoft.DataValueType.LOOKUP,

                "lookupListConfig": {"filters": [

                    BaseFiltersGenerateModule.OwnerFilter

                ]}

            }



2. Change define part in the Case page ("UsrBaseFiltersGenerateModule" for BaseFiltersGenerateModule):



define("CasePageV2", ["UsrBaseFiltersGenerateModule"], 

    function(BaseFiltersGenerateModule)



3. Add UsrBaseFiltersGenerateModule schema (you can see commented options for users with or without license as well):

define("UsrBaseFiltersGenerateModule", ["UsrBaseFiltersGenerateModuleResources", "ConfigurationConstants"], 
	function(resources, ConfigurationConstants) {
		function getIsNotNullFilterGroup(refSchema) {
			const userFilter = Terrasoft.createColumnIsNotNullFilter(refSchema + ".Id");
			const filters = Ext.create("Terrasoft.FilterGroup");
			filters.addItem(userFilter);
			return filters;
		}
 
		function employeesFilter() {
			const sysAdminUnitRef = "[SysAdminUnit:Contact]";
			const employeesFilter = Terrasoft.createColumnFilterWithParameter(Terrasoft.ComparisonType.EQUAL,
					sysAdminUnitRef + ".ConnectionType",
					ConfigurationConstants.SysAdminUnit.ConnectionType.AllEmployees);
			// const hasLicFilter = Terrasoft.createExistsFilter("[SysAdminUnit:Contact].[SysLicUser:SysUser].Active");
			const isActiveUserFilter = Terrasoft.createColumnFilterWithParameter(Terrasoft.ComparisonType.EQUAL, "[SysAdminUnit:Contact].Active", true);
			const filters = getIsNotNullFilterGroup(sysAdminUnitRef);
			filters.addItem(employeesFilter);
			// filters.addItem(hasLicFilter);
			filters.addItem(isActiveUserFilter);
			return filters;
		}
 
		function allUsersFilter() {
			return getIsNotNullFilterGroup("[VwSystemUsers:Contact]");
		}
 
		function selfFilter() {
			let primaryColumnName = "Id";
			if (this.entitySchema && this.entitySchema.primaryColumnName) {
				primaryColumnName = this.entitySchema.primaryColumnName;
			}
			const primaryColumnValue = this.get(primaryColumnName);
			return Terrasoft.createColumnFilterWithParameter(
				Terrasoft.ComparisonType.NOT_EQUAL, primaryColumnName, primaryColumnValue);
		}
 
		return {
			OwnerFilter: employeesFilter,
			SelfFilter: selfFilter,
			AllUsersFilter: allUsersFilter
		};
	});



 

Hello, Fulgen!



Unfortunately, Creatio can not set up additional filtering with OOB functionality for the " Responsible " field. It is possible to solve your business task by creating business rules using development tools. And we have already registered a request for the responsible R&D team to research the possibility of implementation of this solution for the future releases of Creatio application.

Thanks, Vladimir Sokolov

This is exactly what I need, but I am having some issues getting this to work.

I've done all 3 steps, but clearly have an issue with Step 1 as I am getting errors on the Case Page. When I add the Owner filter in the CasePage client module and compile, then CasePage will not load.

So, a newbie question for you, within what section of the CasePage code should the Owner element be added? I assumed businessRules, rather than attributes, modules, details, methods, dataModels, or diff.

I dropped it in as the last businessRules element (adding appropriate , and such). Things compile fine but the Case page does not load. 

"Owner": {

                "dataValueType": Terrasoft.DataValueType.LOOKUP,

                "lookupListConfig": {"filters": [

                    BaseFiltersGenerateModule.OwnerFilter

                ]}

            }

The first time that I tried this I got an error on browser console that BaseFiltersGenerateModule was unknown (sorry, I did not save the exact text of the error, but can reproduce it). So I added BaseFiltersGenerateModule into the define/function statement at the start of CasePage.

Show all comments