help with forumla url returning user to page of record

  • 0
  • 1
  • Question
  • Updated 2 years ago
  • Answered
I have a button set for users to confirm receipt of a request. I'd like, after they've pressed that button, for them to be returned to the exact same record, on the exact same form. Is that possible? Here is the formula URL that I'm using with the button. Help?

var text URLONE = URLRoot() & "db/" & Dbid()
& "?act=API_EditRecord&rid=" & [Record ID#]

& "&apptoken=" & "daszufyd548iwsdg4qcshck5ve6b"

& "&_fid_119=" & URLEncode (User())

& "&_fid_120=" & URLEncode (Today())

& "&_fid_118=Yes";

var text URLTWO = URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#];
$URLONE
& "&rdr=" & URLEncode($URLTWO)
Photo of Jay (DDS)

Jay (DDS)

  • 430 Points 250 badge 2x thumb

Posted 2 years ago

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

QuickBaseCoach App Dev./Training, Champion

  • 51,436 Points 50k badge 2x thumb
Here is an example of code which will edit a record and then refresh the page.  The useful aspect of this code is that it will refresh either the form you happen to be on, if you have multiple forms or it will also refresh the report that happen to be on.  

Using this on a report can be useful especially if the user is say marking off records that have been completed.  They would click the button and the report would refresh with one less record on it.


var text URL= URLRoot() & "db/" & [_DBID_TABLE_1] & "?act=API_EditRecord"
& "&rid=" & URLEncode ([Record ID#])
& "&_fid_7=" & URLEncode ([Status])
& "&apptoken=" & "XXXX";


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

Jay (DDS)

  • 430 Points 250 badge 2x thumb
Looks great....so, where would I insert the change to my formula? I tried this, but it didn't work.

var text URLONE = URLRoot() & "db/" & Dbid()
& "?act=API_EditRecord&rid=" & [Record ID#]

& "&apptoken=" & "daszufyd548iwsdg4qcshck5ve6b"

& "&_fid_119=" & URLEncode (User())

& "&_fid_120=" & URLEncode (Today())

& "&_fid_118=Yes";

var text URLTWO = URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#];
$URLONE
& "&rdr=" & URLEncode($URLTWO)

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

Chris, Champion

  • 4,390 Points 4k badge 2x thumb

Correct me if I'm wrong, but I believe Mark wants you to try this:


var text URL= URLRoot() & "db/" & [_DBID_TABLE_1] & "?act=API_EditRecord"
& "&rid=" & URLEncode ([Record ID#])
& "&_fid_119=" & URLEncode (User())
& "&_fid_120=" & URLEncode (Today())
& "&_fid_118=Yes";
& "&apptoken=" & "daszufyd548iwsdg4qcshck5ve6b";

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

Replace [_DBID_TABLE_1] with the alias name of your table.

Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 51,436 Points 50k badge 2x thumb
You have duplicate semi colons. The last two lines both have semi colons, remove the first one.
Photo of Chris

Chris, Champion

  • 4,390 Points 4k badge 2x thumb

If 118 is a check box, then & "&_fid_118=" & URLEncode(true)

Photo of Jay (DDS)

Jay (DDS)

  • 430 Points 250 badge 2x thumb
This is what I'm putting in:

var text URL= URLRoot() & "db/" & [_DBID_INTERPRETING_REQUESTS] & "?act=API_EditRecord"
& "&rid=" & URLEncode ([Record ID#])
& "&_fid_119=" & URLEncode (User())
& "&_fid_120=" & URLEncode (Today())
& "&_fid_118=Yes";
& "&apptoken=" & "daszufyd548iwsdg4qcshck5ve6b";

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

This is the error I get when I'm trying to save:

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

var text URL= URLRoot() & "db/" & [_DBID_INTERPRETING_REQUESTS] & "?act=API_EditRecord"
& "&rid=" & URLEncode ([Record ID#])
& "&_fid_119=" & URLEncode (User())
& "&_fid_120=" & URLEncode (Today())
& "&_fid_118=Yes";
& "&apptoken=" & "daszufyd548iwsdg4qcshck5ve6b";

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

More on syntax errors...
Photo of Jay (DDS)

Jay (DDS)

  • 430 Points 250 badge 2x thumb
118 is a Text-Multiple Choice field
Photo of Chris

Chris, Champion

  • 4,390 Points 4k badge 2x thumb
_fid_118=Yes";  <<<< remove that semi -colon.
Photo of Jay (DDS)

Jay (DDS)

  • 430 Points 250 badge 2x thumb
That did it! Thanks!