- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2022 10:59 PM
Hi All,
We need to remove knowledge base from portal based on company, for example company A and company B, if the user from company A, he could be able to see the knowledge base, if the user from company B, we need to hide knowledge base for them, could you please help on this to achieve.
Thanks in Advance!!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2022 11:31 PM
@Rishi32 then you might have to clone the ICON link widget to do this because the widget that you are seeing is OOB which is called as ICON link where you can put conditions as the code is not editable .
So you need to clone that widget and replace your cloned widget in your homepage and then code in the server script accordingly by getting the logged in users company and then hide it for company B users
steps:
1) Go to widget table and then open icon link widget
2) Open the icon link widget and hit clone widget button
3) Then you need to write the below script in HTML and server part to get the logged in user company and then hide it if its comp B
<div ng-if="data.compB==false"> <!--added this line to check if its compb-->
<div class="iconlink" ng-class="{'high-contrast': accessibilityModeEnabled}">
<!--// Top Icon -->
<a ng-if="::(options.link_template == 'Top Icon' || !options.link_template)" ng-href="{{::data.href}}" class="top_icon {{::options.class_name}}" target="{{::data.target}}">
<div class="m-b fa fa-{{::options.glyph}} fa-4x {{::options.class_name}} text-{{::options.color}}"></div>
<h2>{{::options.title}}</h2>
<span class="text-muted">{{::options.short_description}}</span>
</a>
<!--// Circle Icon -->
<a ng-if="::(options.link_template == 'Circle Icon')" ng-href="{{::data.href}}" class="circle_icon {{::options.class_name}} text-{{::options.color}}" target="{{::data.target}}">
<span class="fa fa-stack fa-2x" aria-hidden="true">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-{{::options.glyph}} fa-stack-1x fa-inverse"></i>
</span>
<h2>{{::options.title}}</h2>
<span class="text-muted">{{::options.short_description}}</span>
</a>
<!--// Color Box -->
<a ng-if="::(options.link_template == 'Color Box')" ng-href="{{::data.href}}" class="color_box {{::options.class_name}} icon-link-background-{{::options.color}} text-white" target="{{::data.target}}">
<div class="fa fa-{{::options.glyph}} fa-3x {{::options.class_name}}"></div>
<h2>{{::options.title}}</h2>
<span>{{::options.short_description}}</span>
</a>
</div>
</div><!--added this line to check if its compb-->
In the above HTML code i have added first line and last line to the cloned widget
Server script :
(function(){
var gr = $sp.getInstanceRecord();
data.href = $sp.getMenuHREF(gr);
data.target = options.target || "";
var companyID = gs.getUser().getCompanyID();
data.compB=false;
if(companyID=="your company b sys_id")
{
data.compB=true;
}
})();
You can paste the above server script
4)Then open your homepage and replace your cloned widget in place of knowledge base widget like below
Open your home page which i am assuming as "index " page and then click on instance with link on knowledge base as highlighted below
5) then after opening the record replace your cloned widget in widget column
Hope this helps
Mark the answer correct if this helps you
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2022 10:59 PM
Please find the attachment
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2022 11:06 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2022 11:15 PM
Hi Mohith,
Yes, We need to hide knowledge base completely for company B users
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2022 11:31 PM
@Rishi32 then you might have to clone the ICON link widget to do this because the widget that you are seeing is OOB which is called as ICON link where you can put conditions as the code is not editable .
So you need to clone that widget and replace your cloned widget in your homepage and then code in the server script accordingly by getting the logged in users company and then hide it for company B users
steps:
1) Go to widget table and then open icon link widget
2) Open the icon link widget and hit clone widget button
3) Then you need to write the below script in HTML and server part to get the logged in user company and then hide it if its comp B
<div ng-if="data.compB==false"> <!--added this line to check if its compb-->
<div class="iconlink" ng-class="{'high-contrast': accessibilityModeEnabled}">
<!--// Top Icon -->
<a ng-if="::(options.link_template == 'Top Icon' || !options.link_template)" ng-href="{{::data.href}}" class="top_icon {{::options.class_name}}" target="{{::data.target}}">
<div class="m-b fa fa-{{::options.glyph}} fa-4x {{::options.class_name}} text-{{::options.color}}"></div>
<h2>{{::options.title}}</h2>
<span class="text-muted">{{::options.short_description}}</span>
</a>
<!--// Circle Icon -->
<a ng-if="::(options.link_template == 'Circle Icon')" ng-href="{{::data.href}}" class="circle_icon {{::options.class_name}} text-{{::options.color}}" target="{{::data.target}}">
<span class="fa fa-stack fa-2x" aria-hidden="true">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-{{::options.glyph}} fa-stack-1x fa-inverse"></i>
</span>
<h2>{{::options.title}}</h2>
<span class="text-muted">{{::options.short_description}}</span>
</a>
<!--// Color Box -->
<a ng-if="::(options.link_template == 'Color Box')" ng-href="{{::data.href}}" class="color_box {{::options.class_name}} icon-link-background-{{::options.color}} text-white" target="{{::data.target}}">
<div class="fa fa-{{::options.glyph}} fa-3x {{::options.class_name}}"></div>
<h2>{{::options.title}}</h2>
<span>{{::options.short_description}}</span>
</a>
</div>
</div><!--added this line to check if its compb-->
In the above HTML code i have added first line and last line to the cloned widget
Server script :
(function(){
var gr = $sp.getInstanceRecord();
data.href = $sp.getMenuHREF(gr);
data.target = options.target || "";
var companyID = gs.getUser().getCompanyID();
data.compB=false;
if(companyID=="your company b sys_id")
{
data.compB=true;
}
})();
You can paste the above server script
4)Then open your homepage and replace your cloned widget in place of knowledge base widget like below
Open your home page which i am assuming as "index " page and then click on instance with link on knowledge base as highlighted below
5) then after opening the record replace your cloned widget in widget column
Hope this helps
Mark the answer correct if this helps you
Thanks