Skip to main content
Question

help with forumla url returning user to page of record

  • Mar 8, 2017 6:32 PM UTC
  • 0 replies
  • 46 views

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)
This topic has been closed for replies.

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);

  • Author
  • Qrew Corporal
  • Mar 8, 2017 7:10 PM UTC
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);

  • Qrew Corporal
  • Mar 8, 2017 7:21 PM UTC

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.


You have duplicate semi colons. The last two lines both have semi colons, remove the first one.

  • Qrew Corporal
  • Mar 8, 2017 7:28 PM UTC

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


  • Author
  • Qrew Corporal
  • Mar 8, 2017 7:30 PM UTC
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...

  • Qrew Corporal
  • Mar 8, 2017 7:32 PM UTC
_fid_118=Yes";  <<<< remove that semi -colon.

  • Author
  • Qrew Corporal
  • Mar 8, 2017 7:32 PM UTC
118 is a Text-Multiple Choice field

  • Author
  • Qrew Corporal
  • Mar 8, 2017 8:15 PM UTC
That did it! Thanks!