Discussions

Expand all | Collapse all

help with forumla url returning user to page of record

  • 1.  help with forumla url returning user to page of record

    Posted 03-08-2017 13:32
    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)


  • 2.  RE: help with forumla url returning user to page of record

    Posted 03-08-2017 13:48
    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);


  • 3.  RE: help with forumla url returning user to page of record

    Posted 03-08-2017 14:10
    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);


  • 4.  RE: help with forumla url returning user to page of record

    Silver
    Contributor
    Posted 03-08-2017 14:21

    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.



  • 5.  RE: help with forumla url returning user to page of record

    Posted 03-08-2017 14:27
    You have duplicate semi colons. The last two lines both have semi colons, remove the first one.


  • 6.  RE: help with forumla url returning user to page of record

    Silver
    Contributor
    Posted 03-08-2017 14:28

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



  • 7.  RE: help with forumla url returning user to page of record

    Posted 03-08-2017 14:30
    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...


  • 8.  RE: help with forumla url returning user to page of record

    Posted 03-08-2017 14:32
    118 is a Text-Multiple Choice field


  • 9.  RE: help with forumla url returning user to page of record

    Silver
    Contributor
    Posted 03-08-2017 14:32
    _fid_118=Yes";  <<<< remove that semi -colon.


  • 10.  RE: help with forumla url returning user to page of record

    Posted 03-08-2017 15:15
    That did it! Thanks!