UI Page and Widget in Scoped App.

brianc
Kilo Contributor

Hi All,

I've created a small scoped app that has a widget and UI page.   When Adding the widget to my homepage I get the following error:


GlideForm is not allowed in scoped applications


The render function of the widget contains the following code based on code from the wiki (Creating a Custom Homepage Widget - ServiceNow Wiki)

I have modified the code by pre-pending 'global' to the renderer object

2015-03-25 16_36_10-ServiceNow.png

If GlideForm is not allowed in scoped applications, how does one create a custom widget for inclusion in their app?   I played around with various things, like adding the global namespace in front of the GlideForm, and various other things.

The widget gets added to the homepage, but only 'null' is displayed in the content section.   See image:

2015-03-25 16_34_58-ServiceNow.png

Thanks in advance for any help that can be provided.

Brian.

1 ACCEPTED SOLUTION

tltoulson
Kilo Sage

Hi Brian and Paul,



I have figured this out if you are still interested and haven't figured it out on your own yet.   There have actually been a few changes it seems to the API for widgets.   GlideForm is no longer needed directly and the renderer's interface has changed.



Now you need only two things:



renderer.getPreference(<preference name>) => replaces renderer.getPreferences().get(<preference name>)


renderer.getRenderedPage(<ui page name>) => replaces GlideForm, setDirect, setRenderProperties, etc



So your render script should now look like:



function render() {


      var name = renderer.getPreference('name');


      return renderer.getRenderedPage(name);


}



Dynafrom Wang, you may be interested in this as well given your Hackathon Bootstrap CMS.   This can help you get it out of the global scope


View solution in original post

10 REPLIES 10

Oh, are you referring to the notification preferences UI action link in the My Profile page? That would be a different topic than this thread, so you might want to open a new one if you need more assistance ...   That is a highly customized page and re-writting it would be a lot of work. The easiest way in portal would be to put it in an iFrame until if and when SN releases a version of it for portal.