How do I get the base url of my app inside an expression in a server action? I just need it to print "https://mydomain-dev.outsystemsenterprise.com/" or "mydomain-dev.outsystemsenterprise.com"
Please see https://www.outsystems.com/forums/discussion/54418/how-to-get-url-path/
Hey @Daniel Johnson ,
If you are comfortable with java script then try below code in javascript widget and return output
let url=$public.BuiltinFunctions.getBookmarkableURL(); let domain = (new URL(url)); $parameter.out = domain.hostname;
The above code will return
https://mydomain-dev.outsystemsenterprise.com
Thanks,
Yogesh
Hi,
You can simply use the below line of code,
Substr(GetBookmarkableURL(),0,Index(GetBookmarkableURL(),GetOwnerURLPath(),0,searchFromEnd:,ignoreCase:))
But this line of code will work in Client action.
Thanks
Hi Daniel Jonson,
Please go through the below Link.
The GetRequestDomain action from the HTTP handler extension will solve your purpose.
https://success.outsystems.com/documentation/11/reference/outsystems_apis/httprequesthandler_api/#GetRequestDomain
I hope this helps!
Regards,
Saravanan Santhanam.
Hello
To get the base URL of your application in OutSystems, you can use the GetOwnerURL system action. This action provides the base URL at runtime
Name the action GetBaseURLAction.
Add an output parameter BaseURL of type Text
Drag and drop the GetOwnerURL action into the server action flow.
Assign the GetOwnerURL.Url output to the BaseURL output parameter.
i hope it's helps!
Use GetBookmarkableURL()
Hello @Daniel Johnson ,
You should use the built-in GetServerURL function it will provide the base URL of the current environment, including the protocol and domain. 'GetServerURL() '
and if you need to use the base URL inside an expression you can call the function directly within the expression for eg: "The base URL of the application is: " + GetServerURL()
Thanks...