Forum Discussion

LarryThanner's avatar
LarryThanner
Qrew Member
5 years ago

How can i use a formula URL to add new child record then be redirected back to parent record

I have a parent table where when creating a record for this table, there is a button to add children to this record.  so rather than save and exit the form for making the parent record, I have the setting to automatically save.  

So the work flow is as follows, the user makes a parent record and at the bottom of the form hits a button to add children to the table.  I would like to user to be redirected to the parent record after filling out the form for the child.  the following formula i retrieved from a different thread asking and almost identical question:

var text AddChild = URLRoot() & "db/" & [_DBID_FA_IR_DATABASE] & "?a=API_GenAddRecordForm&dfid=2&_fid_22=" & URLEncode ([ID Number]);

var text DisplayParent = URLRoot() & "db/" & Dbid() & "?a=dr&rid="&[ID Number];

$Addchild & "&NextURL"& URLEncode($displayparent)

the problem i am having is two fold,
first: if this formula is called (button pushed) when the parent is first made (automatically saved), the child form is loaded and after filling out the information for the child then the user savees the form, the user gets redirected to a quick base error "record not found"  there is some gibberish about probably deleted or something which is strange because after exiting that error, the parent record that was created is there and the child is also linked to it, but having to exit out of an error page each time a new parent is made is not ideal for the end user.
secondly when an existing parent record is used to then add a child to it, after saving the child it redirects to the child record not the parent record.

any thoughts comments or criticisms are appreciated.  I hope i explained clear enough.

thank you very much

------------------------------
Larry
------------------------------

1 Reply

  • Close, but you are are missing an equals sign

    $Addchild & "&NextURL="& URLEncode($displayparent)

    But you really could just stick with the native add child syntax


    URLRoot() & "db/" & [_DBID_FA_IR_DATABASE] & "?a=API_GenAddRecordForm&dfid=2&_fid_22=" & URLEncode ([ID Number])
    & "&z=" & Rurl()

    that last part

    & "&z=" & Rurl()

    tells quick base to return to the place you came from, be it a report or a record.

    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    markshnier2@gmail.com
    ------------------------------