Forum Discussion

JamesCarr's avatar
JamesCarr
Qrew Trainee
9 months ago

API_AddRecord Then Redirec To Dashboard

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

7 Replies

  • 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?

      • John_Perkins's avatar
        John_Perkins
        Qrew Member

        This is a brilliant idea that I didn't even consider. Formula - URL field gives me a usable link. Whether or not it works, this is incredibly helpful! And it definitely gives me a much better method of trial and error than updating the text in Notepad.

        Thank you kind sir.

  • 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. 

  • 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>"

    • JamesCarr's avatar
      JamesCarr
      Qrew Trainee

      Hello,

      Thanks for replying and sorry for the delayed response. I can't put this in a button on a dashboard though, right? When I select a button bar, I only see URL as the appropriate option.  Nothing else is for a formula. I did use a formula rich text button from a different table to generate the desired URL, so I could copy and paste it into the dashboard button, the URL doesn't produce the desired result. 

      • MarkShnier__You's avatar
        MarkShnier__You
        Icon for Qrew Legend rankQrew Legend

        James,

        Can you your current formula for the button you say that works, also explain the business purpose of what the button is supposed to do?