Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Get Instance URL via UI Builder

BriTaylor
Kilo Sage

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.

1 ACCEPTED SOLUTION

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 PDIs

Now go to events section of the created data resource and click on Add event mapping & add the page script under Data fetch Succeeded event.

.Screenshot 2023-11-17 at 7.28.47 PM.png

 

 

View solution in original post

7 REPLIES 7

Omkar Kumbhar
Mega Sage

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

If I was able to help you with your case, please click the Thumb Icon and mark as Correct.

That does not work in the UIB.

 

BriTaylor_0-1700225805271.png

 

@BriTaylor Can you please try this 

var url = window.parent.location.href;

OR

var url = window.location.href;

 

If I was able to help you with your case, please click the Thumb Icon and mark as Correct.

That also doesn't work in the UIB.

 

BriTaylor_0-1700226942099.png