Skip to main content
Solved

API_AddRecord Then Redirec To Dashboard


Forum|alt.badge.img+9

Greetings,

I have been searching and experimenting for some time now.  I have given up and decided to try posting, as everything I have found is not working so far.  I have a dashboard that I would like to add a button to.  The button is intended to make an API_AddRecord call and then return to the dashboard.  I can get the API_AddRecord URL together and it works as intended.  The desired record will be added successfully.  I have the URL to bring up the dashboard as well.  What I can't get to work putting them both in a formula URL that will return the page to the dashboard after the call is made.  Can someone give me the structure for how this is to work?  Thank you in advance for any input / direction you can provide.

James

Best answer by JamesCarr

I finally picked this back up and just wanted to advise of the solution:

Dashboard URL needs to be constructed a particular way, otherwise, you won't be redirected back to it.  As I stated, I was able to come up with the URL for calling the API_AddRecord, but I couldn't get it to navigate back to my dashboard instead of showing the XML result of the API call.  I discovered that I had to use:

<Your_URL_For_The_API> & "&rdr=" & URLEncode(URLRoot() & "/nav/app/" & DBID() & "/action/showpage?pageID=" & YOUR_PAGE_ID#)

This works perfectly.  I was already using the suggestion above to put together my URL by using a formula text field to come up with everything.  Then I copied the resulting URL text and pasted into the URL of the button widget I added in my dashboard once I saw the resulting link worked.  I hope this helps anyone else who needs it in the future.  Let me know if I can help in anyway. 

View original

MarkStrassel
Forum|alt.badge.img+5

I use something like this for a Rich Text Button, but you can adapt it for a Formula URL field too.

var text returnURL = URLRoot()&"db/"&[TABLE_ID]&"?a=er&apptoken=xxxxx&rid=" & [Record ID#];

var text url = URLRoot() & "db/" & [TABLE_ID] & "?a=API_AddRecord&apptoken=xxxxx&rid="&[Related Record]& "&rdr=" & URLEncode($returnURL);

var text buttonText = "What the Button Says";

"<a class='SaveBeforeNavigating' style='"& [Orange Button] & "' href='" & $URL  & "'>" & $buttonText & "</a>"


Forum|alt.badge.img+9
  • Author
  • Registered
  • October 5, 2024

Going through my notifications and see you replied but I never saw it. I had to drop this project due to a host of other business and personal matters. If I continue to have issues when I pick this back up, I can start another thread. Thank you for always following up, and all that you do on these forums. 


Forum|alt.badge.img+4

I'm having this same issue and am wondering if anyone has ever figured it out. Button on Dashboard runs the API call, but after it runs it just leaves us on the API page with the results of the call. I've not been able to set up the URL to redirect back to the Dashboard. Can't use any of the functions like RURL() because it's just a link.

Using rdr=URL_I'm_RedirectingTo doesn't do anything. Neither does using a=doredirect&z=URL_I'm_RedirectingTo. I've tried all sorts of combinations of these and still just land on the XML results. What's the trick to get this working?


Forum|alt.badge.img+9
  • Author
  • Registered
  • Answer
  • June 26, 2025

I finally picked this back up and just wanted to advise of the solution:

Dashboard URL needs to be constructed a particular way, otherwise, you won't be redirected back to it.  As I stated, I was able to come up with the URL for calling the API_AddRecord, but I couldn't get it to navigate back to my dashboard instead of showing the XML result of the API call.  I discovered that I had to use:

<Your_URL_For_The_API> & "&rdr=" & URLEncode(URLRoot() & "/nav/app/" & DBID() & "/action/showpage?pageID=" & YOUR_PAGE_ID#)

This works perfectly.  I was already using the suggestion above to put together my URL by using a formula text field to come up with everything.  Then I copied the resulting URL text and pasted into the URL of the button widget I added in my dashboard once I saw the resulting link worked.  I hope this helps anyone else who needs it in the future.  Let me know if I can help in anyway.