How to restrict widget access in service portal to only a specific Portal?

F_bio Gon_alves
Tera Expert

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

1 ACCEPTED SOLUTION

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 :



Screen Shot 2017-06-29 at 4.56.22 PM.png



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.


View solution in original post

16 REPLIES 16

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 :



Screen Shot 2017-06-29 at 4.56.22 PM.png



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.


It is now fully working.



Thanks for all the help Chirag Bagdai.




Best regards,



Fábio Gonçalves