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, but on step #1. How do I bring the user back to the last step they were on?
URLRoot() & "db/" & [_DBID_TABLE_ALIAS_HERE] & "?a=API_GenAddRecordForm&_fid_6=" & URLEncode ([Record ID#])& "&z=" & Rurl()The app uses New Grid Reports. I tried having the user add records in-line, however those rely on lookups to the parent and they won't save, saying that the lookup value is not set.
I created a new Formula URL button to redirect back to that specific tab. It works when editing/viewing records but not when adding.
URLRoot() & "db/" & [_DBID_TABLE_ALIAS_HERE] & "?a=API_GenAddRecordForm&_fid_6=" & URLEncode ([Record ID#]) & "&NextURL=" & URLEncode(URLRoot() & "db/" & Dbid() & "/form?a=er&rid=" & [Record ID#] & "&page=2")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() )