Forum Discussion

RyanRyan's avatar
RyanRyan
Qrew Member
11 years ago

Using rdr function to return to the originating page

I have an approved button that is used to edit three fields in a record using the API_EditRecord function. I want to redirect back to the originating page but I can't seem to find a way to do this with the rdr function.

Sometimes this is an individual record and sometimes it is a report so I don't want to specify that it redirects to one or the other exclusively.

Any help would be much appreciated.

Thanks,

  • If you are just editing a single record, I think that this will work on a report or a record. It comes from this discussi0on here where Xavier fan chimed in. https://quickbase-community.intuit.com/questions/839147-url-formula-button-refresh-current-page-not-...



    var text URL =
    URLRoot() & "db/" & Dbid () & "?act=API_EditRecord&rid=" & [Record ID#]
    & "&_fid_12="&URLEncode("Closed");

    "javascript:" &
    "$.get('" &
    $URL &
    "',function(){" &
    "location.reload(true);" &
    "});"
    & "void(0);"
  • Thanks for the response, I tried this and am getting a Syntax error message.  I'm not all that familiar with this stuff but here is what I have;
    URLRoot()&"db/"&Dbid()&"?act=API_EditRecord&rid="&[Item ID#]&"&_fid_212="&URLEncode("yes")&"&_fid_215="&URLEncode(User())&"&_fid_213="&URLEncode(Today())&";"

    Where/how exactly should I insert this function you pasted here?

    Thanks again.
  • OK, so try this

    var text URL = URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&rid="&[Item ID#]
    & "&_fid_212="&URLEncode("yes")
    & "&_fid_215="&URLEncode(User())
    & "&_fid_213="&URLEncode(Today());

    "javascript:" &
    "$.get('" &
    $URL &
    "',function(){" &
    "location.reload(true);" &
    "});"
    & "void(0);"
  • Perfect!  I see where I went wrong now.  Thanks for the help.
  • You also see how I like to write the code for human readability, sort of vertically.  The syntax editor in QuickBase doesn't care, but its easier to read and debug with some vertical alignment.
  • I used your code in my case and it gives me error: "A variable declaration must end with a semi-colon." When I add a semicolon at the end I get following syntax error:

    Formula syntax error

    A formula cannot end with an assignment to a variable declaration.
    See below:


    Here is my code with token removed for privacy.


    var text URL = URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&apptoken=bw7794gchxhnxvdd8y8shtyxg28&\nrid=" & [Record ID#] &
    "&_fid_174=" & URLEncode("Ready for Scrubbing")& 
    "&_fid_171=" & Today() &
    "&_fid_170=" & UserToEmail(User()) & 



    "javascript:" &
    "$.get('" &
    $URL &
    "',function(){" &
    "location.reload(true);" &
    "});"
    & "void(0);";

    Please let me know what is wrong here?

    Thanks, 

    Fenil

  • There are some extra characters in your code.

    Try this

    var text URL = URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&rid=" & [Record ID#] 
    & "&apptoken=bw7794gchxhnxvdd8y8shtyxg28"
    & "&_fid_174=" & URLEncode("Ready for Scrubbing") 
    & "&_fid_171=" & Today() &
    & "&_fid_170=" & UserToEmail(User());


    "javascript:" &
    "$.get('" &
    $URL &
    "',function(){" &
    "location.reload(true);" &
    "});"
    & "void(0);";

  • Great. It worked. Now since I am using this on a button how can I use a condition like If([Work Flow Status]= "Awaiting Folders", then only show the button otherwise leave it blank? 
  • np, just keep the top part and then for the javascript stuff, wrap it in the IF




    If([Work Flow Status]= "Awaiting Folders",

    "javascript:" &
    "$.get('" &
    $URL &
    "',function(){" &
    "location.reload(true);" &
    "});"
    & "void(0);";
    )