Using a SP Widget on Ui16

Thanks Andrew Pishchulin for this

How to add a SP widget to UI16

A while ago Andrew Pishchulin shared a post on Medium where he put a Service Portal widget on UI16. My mind was blown. How did he do it.

His post doesn't go over the specifics but here's what he said;

Service Portal widget can also be used in ServiceNow native UI, all you need to do is just to create a UI Macro/formatter which loads a service portal page with that widget

The way to do this (again thanks to Andrew) is this;

  1. Create an empty Service Portal (I'll name mine "widgetOnly")
  2. Create a Portal Page (I'll name mine "pageForHelloWorld")
  3. Add your widget to the Portal Page
  4. Create a UI Macro (I'll name mine "spHelloWorld") with this code, change height as needed
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<iframe src="widgetOnly?id=pageForHelloWorld" width="100%" scrolling="no" style="border:none;min-height:400px;">
</iframe>
</j:jelly>
  1. Create a UI Formatter with the formatter called "spHelloWorld.xml" and set the table you want.
  2. Add the formatter on the form (same way you'd add a field, via form layout)