Forum Discussion

BaileyDesormeau's avatar
BaileyDesormeau
Qrew Member
6 months ago

URL Formula Help, adding a record on a child table from a child table that is not related

Good afternoon,

I hope this is possible, I am on a child table, i was hoping to be able to have a button that checks a check box, showing that an asset needs maintenance, then creating a maintenance report in the maintenance table. The table the button is on is not related to the maintenance table. So in my limited amount of url formula knowledge I suspected that I needed to somehow get back to the parent table which is related to the maintenance table, then go from the parent table, to the maintenance table to then create a maintenance report that will bring in that record ID, then bring me back to the table i started on. I created an action from the initial child table that when the checkbox was checked it created a new record in the maintenance table, but i figured it was not possible to get the related id over there because the place of origin, where the "needs maintenance" checkbox is checked, is not directly related to the maintenance report. I hope this makes sense. My current formula URL is this:

var text URLONE = URLRoot() & "db/" & Dbid()& "?act=API_EditRecord&rid=" & [Record ID#] & "&_fid_163=1";
var text URLTWO = URLRoot() & "db/" &  [_DBID_LSA_ASSETS]& "?a=dr&key=" & [Related Asset];
var text URLTHREE= URLRoot() & "db/" & [_DBID_MAINTENANCE_REPORT] & "?a=API_GenAddRecordForm&_fid_9=" & URLEncode ([Related Asset]);
var text URLFOUR = URLRoot() & "db/" & [_DBID_MISSION_ASSIGNMENTS] & "?a=dr&key=" & [Related Mission (ref)];
$URLONE &"&rdr="& URLEncode($URLTWO) & URLEncode("&rdr="&URLEncode($URLTHREE) & URLEncode("&rdr="&URLEncode($URLFOUR)))

I just tried to pull a summary of the checkbox, so if the needs maintenace box is checked the summary would change to 1 on the parent table. Then i created an action off of this but for some reason the action does not fire when the summary changes from 1 to 0, i guess it doesnt count as a modification. i also added a formula checkbox to be checked after the summary field changed to 1 and that for some reason did not make the action fire either. So I am stuck!

Thanks in advance for anyones help!



------------------------------
Bailey Desormeaux
------------------------------

10 Replies

  • I think you are overcomplicating this.  If you just want to land the user on an Add Record form to add a Maintenance record, try this.

    var text URLONE = URLRoot() & "db/" & Dbid()& "?act=API_EditRecord&rid=" & [Record ID#] & "&_fid_163=1";

    var text URLTWO= URLRoot() & "db/" & [_DBID_MAINTENANCE_REPORT] & "?a=API_GenAddRecordForm&_fid_9=" & URLEncode ([Related Asset]);



    $URLONE

    & "&rdr="& URLEncode($URLTWO) 



    ------------------------------
    Mark Shnier (Your Quickbase Coach)
    mark.shnier@gmail.com
    ------------------------------
    • BaileyDesormeau's avatar
      BaileyDesormeau
      Qrew Member

      So close! I just need to be redirected back to where i started. This is what I did to update yours but it gets stuck on the maintenance table:

      var text URLONE = URLRoot() & "db/" & Dbid()& "?act=API_EditRecord&rid=" & [Record ID#] & "&_fid_163=1";

      var text URLTWO= URLRoot() & "db/" & [_DBID_MAINTENANCE_REPORT] & "?a=API_GenAddRecordForm&_fid_9=" & URLEncode ([Related Asset]);

      var text URLTHREE= URLRoot() & "db/"& [_DBID_MISSION_ASSIGNMENTS] & "?a=dr&key=" &[Related Mission (ref)];

      $URLONE

      & "&rdr="& URLEncode($URLTWO)
      & "&rdr="& URLEncode($URLTHREE)

      Also, could you help me understand how it figures out the related record id when the table youre starting from is not related to the maintenance report table? The reason i had to overhaul this is because my initial solution used an action from the table thats not related to create a new maintenance report, but I was not able to copy over the record ID to the maintenance table that would make it relate back to the parent table. Does that make sense?



      ------------------------------
      Bailey Desormeaux
      ------------------------------
      • MarkShnier__You's avatar
        MarkShnier__You
        Icon for Qrew Legend rankQrew Legend

        Try the change in bold.  I am assuming that you want to land the user on an add record form which is a child of the asset and then once the user enters details and saves, then you want to redirect back to the asset record.

        So, are you using new forms or legacy forms? I do know that there are some buggy issues with new forms and how they able to be redirected upon save.

        As for the "Record ID" issue, well I am assuming that the [Related Asset] of the record you are on (perhaps its some kind of inspection record) is the same [Related Asset] of he maintenance record, ie they will both have the same parent asset. 

        var text URLONE = URLRoot() & "db/" & Dbid()& "?act=API_EditRecord&rid=" & [Record ID#] & "&_fid_163=1";

        var text URLTWO= URLRoot() & "db/" & [_DBID_MAINTENANCE_REPORT] & "?a=API_GenAddRecordForm&_fid_9=" & URLEncode ([Related Asset]);

        var text URLTHREE= URLRoot() & "db/"& [_DBID_MISSION_ASSIGNMENTS] & "?a=dr&key=" &[Related Mission (ref)];

        $URLONE

        & "&rdr="& URLEncode($URLTWO)
        & "&NextURL="& URLEncode($URLTHREE)



        ------------------------------
        Mark Shnier (Your Quickbase Coach)
        mark.shnier@gmail.com
        ------------------------------