- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2023 06:59 AM
Hey, everyone.
Trying to find out how to get the current URL in Client Script created in UI Builder. It seems I have no access to 'window' object. Any other alternatives?
Solved! Go to Solution.
- Labels:
-
UI Builder : Next Experience

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2023 01:51 PM
Yeah you should be able to grab a parameter from the url and use it for the src url on the iframe. Unfortunately there's not a great way for the contents of the iframe to communicate back with the UIB page using the oob component. You could build a custom iframe component that would do that, though.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2023 07:25 AM
What exactly are you looking to do here? You can't grab the entire url, but you can pull in url parameters via api.context.props.<urlparmname>.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2023 07:35 AM - edited 11-09-2023 08:25 AM
Hey, Brad
Thank you for your quick response! I want to build the 'source' field of an IFrame component to point to a url in the instance(the url is outside the UI Builder). I thought that I will need to pass the scheme and domain name(https://myInstance.service-now.com), but it seems I can just pass a relative url, and it works.
To confirm, though - is this the correct approach?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2023 07:42 AM - edited 11-09-2023 07:42 AM
@Brad Tilton , on a related note - how do I make the IFrame communicate with the rest of the UI Builder page if I do not have access to 'window' object?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2023 01:51 PM
Yeah you should be able to grab a parameter from the url and use it for the src url on the iframe. Unfortunately there's not a great way for the contents of the iframe to communicate back with the UIB page using the oob component. You could build a custom iframe component that would do that, though.