Article
Creating a user for an employee of any company with the "Our company" type
14:38 Jul 23, 2019
Case
We need to create users of an "Our company" type for the employees of any company, and not only for those belonging to the "Our company" that exists out-of-the-box.
Solution
Change the PrepareEmployeeEditFilter method in the UserEditPage schema as follows:
var filters = e.Filters; filters.Add(new Dictionary<string, object> { {"comparisonType", FilterComparisonType.Equal}, {"leftExpressionColumnPath", "[SysAdminUnit:Contact].Id"}, {"aggregationType", AggregationTypeStrict.Count}, {"useDisplayValue", false}, {"rightExpressionParameterValues", new object[] {0}}}); filters.Add(new Dictionary<string, object> { {"comparisonType", FilterComparisonType.Equal}, {"leftExpressionColumnPath", "Account.Type"}, {"useDisplayValue", false}, {"rightExpressionParameterValues", new object[] { new Guid("57412fad-53e6-df11-971b-001d60e938c6")}}}); e.ParametersValue.Add("hideButtons", true);
where "57412fad-53e6-df11-971b-001d60e938c6" is the ID of the AccountType table that corresponds to the "Our company" value.
Necessary conditions
For version 7.4 only