Button won't redirect back to Record in Application

  • 0
  • 1
  • Question
  • Updated 1 year ago
  • Answered
I have a button in a record in Table 1 that creates a new record in a new table (Table 2), in a different application. When I click save in Table 2, it doesn't redirect me back to the record in Table 1. My code is below. I have check a lot of the forums and I'm almost positive my code is right. 

URLRoot() & "db/bkxq4vvkf?a=API_GenAddRecordForm&_fid_126=" & URLEncode ([Record ID#])& "&_fid_23=" & URLEncode(UserToName(User())) & "&dfid=10" & "&z=" & Rurl()
Photo of Quinten

Quinten

  • 732 Points 500 badge 2x thumb

Posted 1 year ago

  • 0
  • 1
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 51,266 Points 50k badge 2x thumb
You could try this

var text ADD = URLRoot() & "db/bkxq4vvkf?a=API_GenAddRecordForm&_fid_126=" & [Record ID#]
& "&_fid_23=" & URLEncode(UserToName(User()))
& "&dfid=10;


var text Return = urlroot() & "db/" & dbid() & "?a=dr&rid=" & [Record ID#]

$ADD
& "&NextURL=" & URLEncode(Return)
Photo of Quinten

Quinten

  • 732 Points 500 badge 2x thumb
I am getting an error stating that I need to add a semicolon. The "db/" of the second variable all the way to the end of the code is underlined in the error. I did add a semicolon at the end of [Record ID#] but that didn't fix it. 


var text ADD = URLRoot() & "db/bkxq4vvkf?a=API_GenAddRecordForm&_fid_126=" & [Record ID#]
& "&_fid_23=" & URLEncode(UserToName(User())) 
& "&dfid=10;


var text RETURN = URLRoot() & "db/" & dbid() & "?a=dr&rid=" & [Record ID#];

$ADD
& "&NextURL=" & URLEncode(RETURN)
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 51,266 Points 50k badge 2x thumb
Try this. I added a closing quote st the end of the first formula variable

var text ADD = URLRoot() & "db/bkxq4vvkf?a=API_GenAddRecordForm&_fid_126=" & [Record ID#]
& "&_fid_23=" & URLEncode(UserToName(User()))
& "&dfid=10";

var text RETURN = URLRoot() & "db/" & dbid() & "?a=dr&rid=" & [Record ID#];

$ADD
& "&NextURL=" & URLEncode(RETURN)
Photo of Quinten

Quinten

  • 732 Points 500 badge 2x thumb
That fixed one of the errors. I am now getting "The argument list of the function RETURN must begin with a left parenthesis." Not sure what to do with that.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 51,266 Points 50k badge 2x thumb
Corrected

var text ADD = URLRoot() & "db/bkxq4vvkf?a=API_GenAddRecordForm&_fid_126=" & [Record ID#]
& "&_fid_23=" & URLEncode(UserToName(User()))
& "&dfid=10";

var text RETURN = URLRoot() & "db/" & dbid() & "?a=dr&rid=" & [Record ID#];

$ADD
& "&NextURL=" & URLEncode($RETURN)

The formula variable RETURN needs a $ in front of it
Photo of Quinten

Quinten

  • 732 Points 500 badge 2x thumb
Perfect! Thanks again!