- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-29-2017 03:23 AM
Hi SNC,
I have a requirement where I want to add additional widgets to the Form page (id=form) but, they should only be present if I am accessing this Form page through my XXXXX Portal, since this is a page used in many other Portals.
Any ideas on how to set a restriction like this for the additional widgets to be exhibited only on the XXXX Portal?
Thanks in advance.
Fábio Gonçalves
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-29-2017 04:29 AM
Yup. Thanks!
& Just to let you know that in the above suggestion we used validation in client side only.
In Order to validate in server side + client side + HTML - you can use below example :
Server script:
(function() {
data.portal_visible = false;
var portalGr = $sp.getPortalRecord();
if(portalGr.url_suffix == 'sp') {
data.portal_visible = true;
}
})();
Please let me know if you are looking for anything else.
If your query is Resolved, would you mind marking my answer as correct and close the thread.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-29-2017 04:02 AM
if you are using c.selected_portal = $location.$$path.replace('/',''); then only replace "sp" with your portal name
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-29-2017 04:04 AM
This works at portal level for example:
If I am using /sp portal then only this widget HTML will be visible.
Let me know if you are looking for something else.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-29-2017 04:10 AM
I am afraid I still couldn't make it work 😞
Lets imagine this is my HTML Template:
<div ng-if="c.selected_portal == '/ServiceNow Training'"> -> Where ServiceNow Training is the name (not id) of my Portal
<!-- widget template ->>
</div>
And that this is my Client Script:
function($scope,$location) {
/* widget controller */
var c = this;
c.selected_portal = $location.$$path.replace('/','');
}
What am I missing here?
Thanks,
Fábio Gonçalves
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-29-2017 04:17 AM
just remove "/" from ng-if because in my latest response I am replacing it with blank value in client controller :
so try with "ng-if="c.selected_portal == 'ServiceNow Training'"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-29-2017 04:21 AM
I removed the "/" and still didn't work. Then I used the Portal ID instead of Portal Name and it seems to be working now.
Does that make sense?
Thanks,
Fábio Gonçalves