Forum Discussion

BethanyHudson's avatar
BethanyHudson
Qrew Trainee
3 years ago

URL Button Doesn't Work in Edit Mode

I've got a URL button "Submit" that creates a child record then redirects to the parent table. It works great, but I can't do it while in edit mode, which is really the place I need it. I want staff to be able to click "Submit" as they are entering data and not have to save it the record then click the button.

------------------------------
Bethany Hudson
------------------------------
  • Can you post your current code?  Is the advanced settings for your table set to save parent automatically

    "Auto save when redirected away from the page"

    Your workflow that you were sitting on a parent record editing the parent record and then clicking submit which is supposed to save the parent record and add a child record?  When they press submit where do you want to land the user?

    ------------------------------
    Mark Shnier (YQC)
    mark.shnier@gmail.com
    ------------------------------
    • BethanyHudson's avatar
      BethanyHudson
      Qrew Trainee
      Clicking Submit adds a child record and the user lands back to their task table.
      var text add= URLRoot() & "db/" & [_DBID_AGGREGATE_TASKS]& "?a=API_AddRecord"& "&_fid_80=" & URLEncode([Record ID#]);
      var text URLTHREE = URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & ToText([Record ID#]);
      var text Redirect = URLRoot() & "db/" & [_DBID_TASKS] & "?a=q&qid=1&rid=";
      $add
      & "&rdr=" & URLEncode($URLThree)
      & URLEncode ("&rdr=" & URLEncode($Redirect))​


      ------------------------------
      Bethany Hudson
      ------------------------------
      • MarkShnier__You's avatar
        MarkShnier__You
        Icon for Qrew Legend rankQrew Legend
        1. Is the advanced settings for your table set to save parent automatically
        "Auto save when redirected away from the page"

        2. Can you clarify the desired workflow?


        ------------------------------
        Mark Shnier (YQC)
        mark.shnier@gmail.com
        ------------------------------
  • Hi Bettany;
    You can create formula rich text field and use that instead. Formula below is saving master table record then adding child record and returns back to master table record. I hope this helps

    Parameters: fid=48 is related project in task table and fid=6 is task name field in Task table.

    var text url=URLRoot() & "db/" & [_DBID_TASKS] & "?a=API_AddRecord&_fid_48="&[Record ID#]&"&_fid_6=test"&
    "&rdr=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#]);

    "<a class='Vibrant Success SaveBeforeNavigating' style='background: #6BBD57; border: 1px solid #6BBD57' href='" &$url&"'>Add  Task Record</a>"

    Thank you

    ------------------------------
    Razi D.
    Desta Tech LLC
    razi@destatechs.com
    ------------------------------
    • MarkShnier__You's avatar
      MarkShnier__You
      Icon for Qrew Legend rankQrew Legend
      Bettany,
      Razi is correct. In your use case you will need to use a formula Rich text field type.  
      I believe that you are saying that your workflow is to be on an Add Record form for a Task.  You want to save the record but AFTER the Record ID# is created, you want to also automatically create a record in a different table called Aggregate Tasks.

      Try this as a Rich Text formula field.

      but your code canny be copy pasted.

      // define $add and $ ReDirect here

      var text URL =
      $Add
      & "&rdr=" & URLEncode($ReDirect);


      "<a class='Vibrant Success SaveBeforeNavigating' style='background: #6BBD57; border: 1px solid #6BBD57' href='" & $url & "'>Add  Task Record</a>"









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