- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2023 04:47 AM
Hello All,
I am trying to retrieve our instance URL in the UI Builder and am I have been unable to accomplish this.
The reason why I am trying to do this is we have a button on our workspace home page that links to our service portal, however this needs to be updated manually when we push any changes up through test then production.
I have tried to do this via a script but the traditional methods that I know about have not worked.
Any suggestions would be greatly appreciated.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2023 06:12 AM
Hi @BriTaylor,
Go to table sys_ux_data_broker_transform, create a new one.
Add the below script.
function transform(input){return gs.getProperty('instance_name');}Now come back to UI Builder, refresh the page. Now add the new data resource created and make sure you create the execute ACL for the data broker otherwise you'll get error for the same.
Now create a page script.. add the below script.
const instanceName = api.data.get_instance_name_1.output;//replace get_instance_name_1 with your data resource id.
console.log(instanceName);//output will be "devXXXXX" for PDIsNow go to events section of the created data resource and click on Add event mapping & add the page script under Data fetch Succeeded event.
.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2023 04:54 AM
Hello @BriTaylor ,
Did you tried call the property instance_name in the ui bilder script. this will give you the URL of instance
var instanceName = gs.getProperty('instance_name');Thank you,
Omkar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2023 04:56 AM
That does not work in the UIB.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2023 05:00 AM - edited 11-17-2023 05:00 AM
@BriTaylor Can you please try this
var url = window.parent.location.href;
OR
var url = window.location.href;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2023 05:15 AM
That also doesn't work in the UIB.
