Hi Creatio Community,
I'm currently working with an editable detail grid, and I need to filter a lookup column (UsrPort
) based on the connected user's roles ("Stay SPOC TC", "Stay SPOC Casablanca", "Stay SPOC Jorf Lasfar", "Stay SPOC Laayoune", and "Stay SPOC Safi").
I've tried several approaches including:
generateActiveRowControlsConfig: function(id, columnsConfig, rowConfig) {
this.mixins.ConfigurationGridUtilitiesV2.generateActiveRowControlsConfig.call(this, id, columnsConfig, rowConfig);
var scope = this;
Terrasoft.each(rowConfig, function(columnItem) {
var columnKey = columnItem.key && columnItem.key[0];
if (columnKey && columnKey.name === "UsrPort") {
columnItem.controlConfig = columnItem.controlConfig || {};
columnItem.controlConfig.lookupListConfig = columnItem.controlConfig.lookupListConfig || {};
columnItem.controlConfig.lookupListConfig.filter = function() {
var filters = Terrasoft.createFilterGroup();
// Example of role checks
var allowedPorts = [];
if (scope.get("IsStaySpocCasa")) allowedPorts.push("CASABLANCA");
if (scope.get("IsStaySpocJorf")) allowedPorts.push("JORF LASFAR");
// Add similar checks for other roles
if (allowedPorts.length > 0) {
filters.add("PortFilter", Terrasoft.createColumnInFilterWithParameters("Name", allowedPorts));
} else {
filters.add("EmptyFilter", Terrasoft.createColumnFilterWithParameter(
Terrasoft.ComparisonType.EQUAL, "Id", Terrasoft.GUID_EMPTY));
}
return filters;
};
}
}, this);
},
This configuration currently doesn't work and results in the error mentioned above.
Could someone help clarify the correct way to implement role-based filtering on lookup columns within editable detail grids? If anyone has successfully implemented this or faced a similar issue, your guidance would be greatly appreciated!
Thanks in advance for your help!
Best regards,