Forum Discussion

PhilPinkham's avatar
PhilPinkham
Qrew Trainee
6 years ago

Add a new record on a custom form AND view that record on the same custom form once the record is saved.

I have a magic button to add a new record in a specific form ' URLRoot() & "db/" & [DBID XXX] & "?a=API_GenAddRecordForm&_fid_21=" & URLEncode ([XXX]) & "&dfid=18".  It works to add the record, however when I save the new record I am taken to the default form.  How can I save and view the new record on the custom form - "dfid=18" in this case - instead of the default form?

5 Replies

  • You're half way there! You just need to specify the next url at the end of your formula.

    URLRoot() & "db/" & [DBID XXX] & "?a=API_GenAddRecordForm&_fid_21=" & URLEncode ([XXX]) & "&dfid=18 &" & "nexturl=" & URLEncode(URLRoot() & "db/" & [DBID XXX] & "?a=dr&dfid=18&rid=" & [Record ID#])


  • Alas, when you add a record,  you do not know the Record ID# until it gets created.  So I'm stumped on that one.

    • Quick_BaseJunki's avatar
      Quick_BaseJunki
      Qrew Captain
      Ah, good point. The formula URL above was triggered off of an existing record, so it's actually just directing to that record and not the new one... 

      I'll need to test a bit more.

      @Phil Pinkham, where is your button located?
  • The button is located on the form of the parent record.  That "nexturl=" parameter is something I was not aware of.  I'd used "&rdr=" before in other use cases, but that opens up a lot of possibilities. Thanks!  That is a big help in and of itself beyond this specific issue.
    • Quick_BaseJunki's avatar
      Quick_BaseJunki
      Qrew Captain
      That's great! I think you may need to use the nexturl to direct to a page or report vs back to the new record... at a minimum they wont end up on the wrong from.

      Or in the case of the formula I provided above, you could back to the parent record by using its DBID.