I'm currently trying to use GetBookmarkableURL in the server side, but it's always an empty string. I've tried using it inside a Data Action, inside a server action called by the Data Action, and further down.
They way I pictured it working, under the hood, was that it was passing the current request data to every call server side, but doesn't seem so...
So, how can I get the current request URL server side? Am I missing something?
I tested that a while ago and it seems that GetBookmarkableURL() only returns something in case of Traditional Web apps (there's probably a good reason for that because of how Traditional vs Reactive web apps work).
There are other options, depending on what you're looking for exactly. Try GetURL() or GetRawURL() in a ServerAction in Reactive. Beware that the server part of the resulting string "https://server.domain.com" will be different when you run the same logic from within BPT or a Timer. Your best bet on getting the actual server name that always works is an Aggregate on System.Parameter and get the value for Default DNS name.
Hi,
Did you already tried to use a new input parameter (like URL) and, where youcall that action in the client side, use in the input value the GetBookmarkableURL() ?
Probably like this you will receive the needed URL inside your server action.
Hope this can help.
Best regards,
Ricardo Pereira
TL;DRI used GetRequestHeader("Referer") inside the server action. It seems to return, constantly, the same as GetBookmarkableURL() would.
Long Version:
I've tried GetURL() and GetRawURL(), the ones mentioned by Wouter, but that returns "/AppName/screenservices/...", not the URL of the current screen the user is accessing.
Nonetheless, that made me realize I was forgetting that this is async, which means each server call is a request to a "screen service" endpoint, so the current URL inside a server action will never be the screen URL, but the current service URL. That's why GetBookmarkableURL() won't work.
So, I tried Ricardo's way and it indeed works, as expected, but the goal of this is to create a request that multiple other screens will also make to fetch the current screen's "metadata".
So I didn't want a client that would make the request OnReady, then a separated variable that would hold the result. It seemed the best approach was a DataAction (async, simple, and has everything in the same place).
So I found that I could use, inside the GetCurrentPageMetadata(), a GetRequestHeader("Referer"), and it works.
Not the prettiest way, but, for now, it will do.
Can I suggest you to encapsulate the server action in a Client Action with the map done to the input and, then, just consume the client action where you need?
This way, you don't need to be worried about the input mapping. and, I think is easier to maintain and implement.
Hope this can help you.