- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2015 01:38 PM
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
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:
Thanks in advance for any help that can be provided.
Brian.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2015 04:25 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2015 01:41 PM
...of course I uploaded the incorrect code image...please take my word for it that I have pre-pended 'global' to the renderer object.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2015 11:15 AM
Hey Brian any luck with this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2015 04:25 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2015 04:34 PM
Thanks for this Travis, very helpful!
We noticed when implementing this, that we also had to prepend the scope to the name in the return. Easiest way to see this is in the UI page where it shows the 'endpoint'.
For example, we have a UI page called 'render_gadget_priority_enquiries' within our scoped app (for the purposes of this lets assume the scope is x_org_app). The endpoint is shown as x_org_app_render_gadget_priority_enquiries.do
When creating our widget we had to use the following code for the render function:
function render() {
var name = renderer.getPreference('type');
return renderer.getRenderedPage("x_org_app_render_gadget_" + name);
}