in a client script, I am able to access the url us...
# suitescript
m
in a client script, I am able to access the url using: window.location.href - is there a server-side equivalent to this?
c
Are you looking for the URL of the server side script or suitelet URL? Or are you wanting the URL of the page that made the call?
m
the page that made the call
c
What kind of script are you working in?
suitelet, userEvent, etc… ?
a
@mg2017 Better, what are you trying to do? some context would help...
k
@mg2017 Server side you can't use browser Object to pull URL but, you can use
N/url
library to pull associated URLS.
m
@alien4u I have buttons on a case record, when clicked, it opens a new sales order. i use the url object to source data from the case to the SO. now I want to link the SO back to the case but it seems I can only get the SO id from a UE script so figured I'll convert the client script to a UE, but as pointed out by others browser object isn't available on UE. @Kevin - will look at
n/url
thanks
a
@mg2017 You can have that button added to the Case with an UserEvent and pass the parameters you want when the button is clicked. But forget about that, you can access the parameters already present in the URL from an UserEvent
beforeLoad
entry point, you will have access to
context.parameters
@mg2017 UserEvent script deployed to the
Sales Order
record on
beforeLoad
, you can access
scriptContext.request.parameters
and you should have access to whatever came in the URL that creates/open that new Sales Order record.
m
fantastic - will look at that, thanks