Discussions

 View Only
  • 1.  Redirecting back to the current form after executing a formula url button

    Posted 06-13-2022 12:08
    Hello,

    I have a few buttons that at the end redirect the user after execution the action to the "default" form for the table. How do I change this so the redirect goes to the current form the user is on? The button is on multiple forms and I want to redirect them back where they came from.

    Thanks!

    ------------------------------
    Ivan Weiss
    ------------------------------


  • 2.  RE: Redirecting back to the current form after executing a formula url button

    Posted 06-13-2022 12:24
    Can you post an example of your current code?

    ------------------------------
    Mark Shnier (YQC)
    mark.shnier@gmail.com
    ------------------------------



  • 3.  RE: Redirecting back to the current form after executing a formula url button

    Posted 06-13-2022 12:31
    It is actually the default add buttons for child tables.  Here is one of them but there are a bunch.  All same general format:

    URLRoot() & "db/" & [_DBID_COMMUNICATION_PLAN] & "?a=API_GenAddRecordForm&_fid_13=" & URLEncode ([Project Number])& "&z=" & Rurl()

    ------------------------------
    Ivan Weiss
    ------------------------------



  • 4.  RE: Redirecting back to the current form after executing a formula url button

    Posted 06-13-2022 12:38
    OK, so I am interpreting that this is your question.

    You have a parent table and it has a two forms. You launch and Add Child button off a Parent record and you want to make sure that when the child record is saved that you land the user in display mode on the specified form that you want.  

    I do not know of any way to actually detect what form the user is launching off of but I guess since you have different forms you can have different buttons for add child.  

    The syntax here should return the user to form number 10 on the parent record.  

    var text AddChild = URLRoot() & "db/" & [_DBID_COMMUNICATION_PLAN] & "?a=API_GenAddRecordForm&_fid_13=" & URLEncode ([Project Number]);

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

     $AddChild
    & "&NextURL=" & URLEncode($ReturnToFormTen) 


    ------------------------------
    Mark Shnier (YQC)
    mark.shnier@gmail.com
    ------------------------------



  • 5.  RE: Redirecting back to the current form after executing a formula url button

    Posted 06-13-2022 15:41
    Mark, will the relatively new return function work for this case?

    & "&rdr="
    & URLEncode(URLRoot() & "db/" & Dbid() & "?a=doredirect&z=" & Rurl())


    ------------------------------
    Mike Tamoush
    ------------------------------



  • 6.  RE: Redirecting back to the current form after executing a formula url button

    Posted 06-15-2022 09:16
    Edited by Steven Shweky 06-15-2022 09:20


  • 7.  RE: Redirecting back to the current form after executing a formula url button

    Posted 06-15-2022 09:22
    @Mike Tamoush  I did a test and in fact it works very nicely.  This code will return the user (after saving the child) to the original form whether it be the main form, say form #2 or an alternative form like form 10 or a report.  So it remembers where the user launched form.


    var text AddChild = URLRoot() & "db/" & [_DBID_CHILD] & "?a=nwr&_fid_7=" & URLEncode ([Record ID#]);

    var text ReturnToOriginalLaunchPoint = URLRoot() & "db/" & Dbid() & "?a=doredirect&z=" & Rurl();

    $AddChild
    & "&NextURL=" & URLEncode($ReturnToOriginalLaunchPoint)​​

    ------------------------------
    Steven Shweky
    ------------------------------