Forum Discussion

Jay_DDS_'s avatar
Jay_DDS_
Qrew Cadet
9 years ago

help with forumla url returning user to page of record

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)
  • 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);
  • 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);
  • ChrisChris's avatar
    ChrisChris
    Qrew Assistant Captain

    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.
  • ChrisChris's avatar
    ChrisChris
    Qrew Assistant Captain

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

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