The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Widget flow in service portal

BhagyasriCh
Tera Contributor

Hi,

 

Need information about widget restriction in service portal.

currently we are having 6 clients , in one of the client portal they requested to build the new widget which should be visible to only one client portal .

can we do this requirement in the client portal or is there any limitations.

 

Thanks,

Bhagya.

5 REPLIES 5

Nawal Singh
Mega Guru

Hi @BhagyasriCh ,

 

Yes, it is possible to restrict a widget to only one client’s portal in ServiceNow.
You can achieve this in one of the following ways:

1.Add the widget only to that portal’s page – the simplest method if each client has separate pages.

2.Use portal check inside the widget script – if using shared pages, check the portal ID using $sp.getPortal() and conditionally show the widget.

 example server script- 

(function() {
  var portal = $sp.getPortal();
  data.showWidget = (portal == 'client1_portal'); // Replace with your portal sys_id
})();

 

In Html validate like this- 

<div ng-if="data.showWidget">
  <!-- Widget content goes here -->
</div>

 

3.Use user roles or company-based logic – restrict visibility based on the logged-in user's role, group, or company.

 

 

If my response is helpful please mark as helpful and accept as solution 

 

Thank you!

Hi Nawal,

 

Thanks for your reply,

We tried the same the widget is not showing for all the clients.

in html what we need to mention the widget content?

 

thanks,

bhagya.

Hi @BhagyasriCh ,

Yes you need to write down the widget content or you can call the existing widget

for existing widget call refer below community link-

 

https://www.servicenow.com/community/itsm-forum/call-a-widget-from-another-widget/td-p/755962

 

Hope it will solve your issue let me know if you need any additional help!!

 

Please mark as helpful if my response help you @BhagyasriCh .

 

Thank you!!

RaghavSh
Kilo Patron

@BhagyasriCh Widgets and portal pages do have user criteria.

 

Add user criteria to your widget (code should return answer true or false based on client condition)

 

Refer : https://www.servicenow.com/docs/bundle/zurich-platform-user-interface/page/build/service-portal/task... 


Please mark the answer correct/helpful accordingly.


Raghav
MVP 2023
LinkedIn