Hi,
I have several tabs on the record view:
Switching between them works as expected. However, I need to conditionally hide one of the tabs (GUS). To achieve this, I started with adding the following entry to the viewConfigDiff:
{ "operation": "merge", "name": "EvGusTabContainer", "values": { "visible": false } }
At first glance, it seems to work correctly because the GUS button actually disappears. Unfortunately, as a result of this operation, the content of the side panel stops corresponding to the selected button. As you can see in the screenshot below, instead of showing the attachments, it displays the content from the VIES tab.
Is there any way to deal with this issue? If I remove the GUS tab instead of just hiding it, everything works as expected — but I need this to happen dynamically (for example, depending on user permissions or other circumstances), binding a view model attribute to "visible".
Like
Not sure why the panel would be showing the wrong one as I think I've done tab hiding like this before, but another approach to hiding tabs that might not have the same issue is using Page Business Rules if you're able? They're less versatile, but are no-code, and may avoid this issue. You'll find these tabs under the "Layout element" option for "Hide elements":


Harvey Adcock,
Hi,
Thank you very much for your response. Unfortunately, this suggestion didn’t solve the problem. Hiding the tab using a business rule does make its contents inaccessible, but the button itself is still visible. Trying to combine both approaches didn’t help either - it behaves the same way as before.
So far, the only working solution is hiding the button by DOM manipulation, but unfortunately, that’s not a elegant solution.
Hello, here is an example on how to do it dynamically:
- create a page parameter on FormPage and use it as attributes value in viewModelConfigDiff:
viewModelConfigDiff: /**SCHEMA_VIEW_MODEL_CONFIG_DIFF*/[
{
"operation": "merge",
"path": [
"attributes"
],
"values": {
"IsUserSystemAdministrator": {
"modelConfig": {
"path": "PageParameters.UsrIsUserSystemAdministrator"
}
},
2. create a handler to set attributes value:
handlers: /**SCHEMA_HANDLERS*/[
{
request : "crt.HandleViewModelInitRequest",
handler : async (request,next) => {
await next?.handle(request);
// create model query and add filters
userRoleModel = await sdk.Model.create("SysUserInRole");
const filter = new sdk.FilterGroup();
//await filter.addSchemaColumnFilterWithParameter(sdk.ComparisonType.Equal, "SysRole.Name", "System administrators");
await filter.addSchemaColumnFilterWithParameter(sdk.ComparisonType.Equal, "SysRole", "83a43ebc-f36b-1410-298d-001e8c82bcad");
await filter.addSchemaColumnFilterWithParameter(sdk.ComparisonType.Equal, "SysUser.Contact", currentUserContact.value);
const results = await userRoleModel.load({
attributes: ["Id"],
parameters: [{
type: sdk.ModelParameterType.Filter,
value: filter
}]
});
// now set the attribute
request.$context.IsUserSystemAdministrator = (results.length > 0);
}
},
3. use Page parameter to show/hide tab or some other element on FormPage:

Hello,
In addition, you could check the approach from here:
https://community.creatio.com/questions/how-can-i-hide-attachment-tabto…