- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā11-18-2019 04:50 AM
Hi Community,
I created one widget with body html to add security information on sc_cat_item of our front office portal.
<div class="panel panel-primary">
<div class="panel-heading">${Security Informations}</div>
<div class="panel-body">
${Please be careful, all information in your request will be readable by everyone so don't put any sensitive information (passwords, etc.). Thank you}
</div>
</div>
Now i want to activate this plugin information only for one portal, sc_cat_item is global use and i don't know how to do it easily...
Someone to help me ? š
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā11-22-2019 01:57 PM
I think you have two options:
1.
Utilize $sp.getPortalRecord() in your widget's server script, like so:
data.isOnSpecificPortal = $sp.getPortalRecord().getUniqueValue() == '{sys id of the portal you want this information to appear on}';
From there, you can check "data.isOnSpecificPortal" from your html in an ng-if, like so:
<div class="panel panel-primary" ng-if="data.isOnSpecificPortal">
2.
Use AngularJS's $locationservice in the client controller by injecting it and calling it like so:
c.isOnSpecificPortal = $location.path().indexOf('{URL suffix of the specific Service Portal}') > -1);
And the you can check c.isOnSpecificPortal in your html:
<div class="panel panel-primary" ng-if="c.isOnSpecificPortal">
Documentation links:
https://developer.servicenow.com/app.do#!/api_doc?v=madrid&id=r_GSPS-getPortalRecord
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā11-22-2019 01:57 PM
I think you have two options:
1.
Utilize $sp.getPortalRecord() in your widget's server script, like so:
data.isOnSpecificPortal = $sp.getPortalRecord().getUniqueValue() == '{sys id of the portal you want this information to appear on}';
From there, you can check "data.isOnSpecificPortal" from your html in an ng-if, like so:
<div class="panel panel-primary" ng-if="data.isOnSpecificPortal">
2.
Use AngularJS's $locationservice in the client controller by injecting it and calling it like so:
c.isOnSpecificPortal = $location.path().indexOf('{URL suffix of the specific Service Portal}') > -1);
And the you can check c.isOnSpecificPortal in your html:
<div class="panel panel-primary" ng-if="c.isOnSpecificPortal">
Documentation links:
https://developer.servicenow.com/app.do#!/api_doc?v=madrid&id=r_GSPS-getPortalRecord