NathanCall
7 years agoQrew Trainee
How to get javascript to return current URL with ""return window.location.href
I have a button that I have on multiple reports that when clicked it will edit the corresponding record and then redirect to the record that was just edited.
However, I would like to return to the same page/report where the button was clicked. I am of the understanding that Rurl() only works with AddGen and does not work with EditRecord.
This is important because we are using this button to make calls through our dialer. When the button is clicked we want to be returned to the same report we were working on. The button is on multiple reports, so I can't hardcode the return URL in the formula field.
I know you can run javascript in a Formula Text or Formula URL field, but I cannot get it to run the javascript that should retrieve the URL. Here is the Javascript I am trying to load, but can't figure it out:
return window.location.href
Here is the code for my button:
"<a href="&URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&apptoken=XXXXXXXXXXX&_fid_264=true&rid=" & [Record ID#] & "&rdr=" & URLEncode(URLRoot() & "db/" & Dbid() & "?act=dr&rid=" & [Record ID#])&">" & "<img width=24 height=24 src=\"
Additionally, I am open to any options to get this to simply send me back to where I was working and not dump me into the record that I just edited. Any suggestions would be helpful. Thanks
However, I would like to return to the same page/report where the button was clicked. I am of the understanding that Rurl() only works with AddGen and does not work with EditRecord.
This is important because we are using this button to make calls through our dialer. When the button is clicked we want to be returned to the same report we were working on. The button is on multiple reports, so I can't hardcode the return URL in the formula field.
I know you can run javascript in a Formula Text or Formula URL field, but I cannot get it to run the javascript that should retrieve the URL. Here is the Javascript I am trying to load, but can't figure it out:
return window.location.href
Here is the code for my button:
"<a href="&URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&apptoken=XXXXXXXXXXX&_fid_264=true&rid=" & [Record ID#] & "&rdr=" & URLEncode(URLRoot() & "db/" & Dbid() & "?act=dr&rid=" & [Record ID#])&">" & "<img width=24 height=24 src=\"
https://phoneimage.com">"
; & "</a>"Additionally, I am open to any options to get this to simply send me back to where I was working and not dump me into the record that I just edited. Any suggestions would be helpful. Thanks