Forum Discussion

hiker85's avatar
hiker85
Qrew Trainee
2 months ago
Solved

Adding child records that rely on lookups in new forms

I have a new-style form that displays pages as steps. The user clicks the button (Formula URL) under step #3 to add a child record. Once they save that record, they're redirected back to the form, bu...
  • Denin's avatar
    2 months ago

    I was able to do it like this:

    Create a code page (copy and paste code below), change page 2 to whatever page or tab you need:

    <script>
    const params = new URLSearchParams(window.location.search);
    
    const parentRid = params.get("parentrid");
    const parentDbid = params.get("parentdbid");
    
    window.location.href =
      "/db/" + parentDbid +
      "?a=er&rid=" + parentRid +
      "&page=2";
    </script>

     

    And then change your formula to this:

    URLRoot() & "db/" & [_DBID_TABLE_ALIAS]
    & "?a=API_GenAddRecordForm"
    & "&_fid_6=" & [Record ID#]
    & "&nexturl="
    & URLEncode(
        URLRoot() & "db/" & Dbid()
        & "?a=dbpage&pageID=72"  //Change 72 to the ID of the code page you created
        & "&parentrid=" & [Record ID#]
        & "&parentdbid=" & Dbid()
    )