Forum Discussion

Re: Refresh parent record after child is created...

The code below will create a child record in the background (while populating two fields), then return to the current record in edit mode, followed by a refresh of the page. You'll just need to plug in your app specific values.

var text URLONE = URLRoot() & "db/" & [_DBID_CHILD_TABLE] &
"?a=API_AddRecord" &
"&_fid_6=FieldA" &
"&_fid_7=07/28/2018" &
"&_fid_8=" & [Record ID#];

var text URLTWO = URLEncode( URLRoot() & "db/" & Dbid() &
"?a=er&rid="& [Record ID#] );

"javascript:" &
"$.get('" & 
$URLONE & "&rdr=" & $URLTWO &
"',function(){" &
"location.reload(true);" &
"});"

3 Replies

  • QuickBaseJunkie's avatar
    QuickBaseJunkie
    Icon for Qrew Legend rankQrew Legend
    Just realized that you are asking specific for mobile. I have not tested this on mobile, but perhaps it will still do the trick.
  • ForrestParker's avatar
    ForrestParker
    Qrew Cadet
    Thanks for the response Quick Base Junkie. 

    However, I don't want to just create a record, I need the following sequence:

    1. User clicks the formula URL within the the parent record
    2. the child record form opens
    3. The user fills in the details about the child record and clicks save
    4. the user is returned to the parent parent record where he/she started and the record is refreshed (specifically the child record count)
    This is the normal behavior when using the desktop version and in mobile, but with one exception.  On mobile, the parent record is not refreshed if you use the formula URL button.  If you use the green plus button that comes with the embedded child record report, then the functionality is identical.  The one drawback of using the embedded green plus button...you can't modify the formula.

    The reason I need the parent record refreshed is because the child record count needs to be updated.  If not, the user adds the child record and is then presented with a child record count of zero; even though one has been saved.  This can be confusing and cause duplicate entries.

    See screenshot below to see the green plus button that I am referring to.
  • QuickBaseJunkie's avatar
    QuickBaseJunkie
    Icon for Qrew Legend rankQrew Legend
    I seem to get different and sometimes buggy behavior depending on what browser I use on my phone with my apps. What I notice is that it is opening a new window vs overwriting the current window, which is why when the child window closes the parent is not refreshed.

    To me, this seems like a bug and not a feature. Have you told Quick Base about it?

    Since you want to open the child record and edit it, have you considered adding a URL button to the child record that will save then redirect to the parent? You could end up with multiple windows open but at least the 'active' one will have the updated record count.