- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2022 01:09 PM
Good Evening,
I have a challenge for everyone, I am currently building a scoped application within ServiceNow, a widget is being placed on the incident form which will dynamically change based on the record being viewed.
I am using a UI Macro and UI Formatter to display the widget on the incident form, the final piece of the puzzle is to be able to grab the record sys_id and pass this to the widget to grab the required data.
UI Macro:
<?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="/$sp?id=checklistwidget" width="100%" scrolling="no" style="border:none;min-height:400px;"></iframe>
<script>
var sysid = ${sys_id}
</script>
</j:jelly>
I can get the sys_id to display on the form, in the widget I tried using gs.getParameter() but I think as this is a scoped application I don't seem to have access to the url.
I also tried to use gs.action.getGlideURI().toString(); but this doesn't return anything either.
Any ideas?
Kind Regards
Ashley
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-27-2022 05:14 AM
Managed to resolve this with using:
var gURI = new GlideURI(); //for Scoped Applications
var sysid = gURI.get('sys_id');
gs.info(sysid);
Further info:
Kind Regards
Ashley
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-27-2022 05:14 AM
Managed to resolve this with using:
var gURI = new GlideURI(); //for Scoped Applications
var sysid = gURI.get('sys_id');
gs.info(sysid);
Further info:
Kind Regards
Ashley