Hi,
In OpportunityPageV2 using custom code I'm checking the type of current user successfully.
initializeCustomCssOpportunityPageV2: function() { var currentUser = Terrasoft.SysValue.CURRENT_USER.value; var sysAdmins = "720b771c-e7a7-4f31-9cfb-52cd21c3739f"; var esq = Ext.create("Terrasoft.EntitySchemaQuery", { rootSchemaName: "SysUserInRole" }); esq.UseAdminRights = false; esq.addColumn("SysRole"); esq.addColumn("SysUser"); esq.filters.add("SysUser", Terrasoft.createColumnFilterWithParameter( Terrasoft.ComparisonType.EQUAL, "SysUser", currentUser)); esq.filters.add("SysRole", Terrasoft.createColumnFilterWithParameter( Terrasoft.ComparisonType.EQUAL, "SysRole", sysAdmins)); esq.getEntityCollection(function(response) { if (response.success) { var result = response.collection; var isPortalUser = (result.collection.length !== 0); if (isPortalUser) { Terrasoft.utils.dom.setAttributeToBody("CustomUIOpportunityPageV2", true); } else { Terrasoft.utils.dom.setAttributeToBody("CustomUIOpportunityPageV2", false); } } }, this); },
If current user is portal user than "CustomUIOpportunityPageV2 = true" otherwise "CustomUIOpportunityPageV2 = false"
In css code its identifying "CustomUIOpportunityPageV2 = true" for portal user and applying the css successfully but its not identifying "CustomUIOpportunityPageV2 = false" when current user is not portal user and not applying css
body[OldUI=false][CustomUIOpportunityPageV2="true"] { .grid-captions { background: black !important; } } [CustomUIOpportunityPageV2="false"] { .grid-captions { background: blue !important; } }
How can css for non portal user should work?
Any help will be highly appreciable
Regards
Like
Hi Muhammad,
I checked on my end - the given CSS works both with true and false value so I assume that your code is giving wrong value. You can open chrome debugging tools and put a break point to check which value you are setting.
To check if the current user is portal or not you can use Terrasoft.isCurrentUserSsp() function instead of the provided snippet.
Regards,
Dmytro
Dmytro Smishchenko,
Thanks for suggestion, its working in "OpportunityPageV2"
From "UsrPortalDashboardCSS" the code is working fine. Whatever css defined its applying everywhere in list/detail/edit views of CRM and Portal (globally).
In code under "BootstrapModulesV2" I'm checking if current user is portal user than only apply CSS. same logic is working fine on other pageV2 for example "AccountPageV2" but the problem is that, CSS only applying on Account Section.
Below code is not working on "BootstrapModulesV2" console log is also not showing output.
Any help will be highly appreciable.
define("BootstrapModulesV2", ["css!UsrPortalDashboardCSS"], function() { return { methods: { init: function() { this.callParent(arguments); this.initializeCustomCSS(); }, initializeCustomCSS: function() { var CurrentUser = this.Terrasoft.isCurrentUserSsp(); if(CurrentUser === true){ this.console.log("Current User is portal user"); Terrasoft.utils.dom.setAttributeToBody("CustomUIPortalUser", true); } else { this.console.log("Current User is not portal user"); Terrasoft.utils.dom.setAttributeToBody("CustomUIPortalUser", false); } } } }; });
Muhammad Shajiuddin,
Below code is not working on "BootstrapModulesV2" console log is also not showing output.
This is because the BootstrapModulesV2 simply returns an empty object, it does not have an init method so your code is never getting called. You can try a different schema to add this to such as MainHeaderSchema and use the init or onRender.
Ryan