Try the following to capture the URL and then build your logic based on the value.
var cURL
cURL = this.baseURL
xfa.host.messageBox(cURL)
this is a JavaScript function may used in form:ready event. If you get the value displayed you can save it and use. I have no similar environment to test this myself. Please let me know how that works.
Good Luck,
SekharN
www.lawson.com