Forum Discussion

RyanStanford1's avatar
RyanStanford1
Qrew Captain
6 years ago

Add Record save button, able to capture the new RecID

I'm working on adding a save button, which will save either an edit record, or save an add record, and then be able to get the new Record ID.


I have code which will work for Editing a record, but not if it's a brand new "add record" form.

------------------------------
Ryan Stanford
------------------------------
  • AustinK's avatar
    AustinK
    Qrew Commander
    I think I saw another post about a similar thing somewhat recently.

    The record ID is created once the record is created. You might be able to see what the most recent record id is and guess what the next would be but this will only work if you have a single person inputting records. If 2 people open the add form at one time(or another opens it before the first saves) then the next record id will be duplicated.

    I'm not sure it is possible to grab the new record id via a button though.. Maybe with javascript there is a way. What are you trying to do exactly? That might help.
    • RyanStanford1's avatar
      RyanStanford1
      Qrew Captain
      Users create a record, and there is a pdf that will be created in the browser and will have fields mapped from the record into the pdf form. As the record will need to be saved prior to the pdf form being created, I need to execute a save.

      The pdf is formed on a html code page, which the code page knows what value to grab because the RecID is sent as a parameter in the link.

      ------------------------------
      Ryan Stanford
      ------------------------------
      • RyanStanford1's avatar
        RyanStanford1
        Qrew Captain
        To follow up on this as I've found a solution...

        Part of the API_AddRecord response contains the new record ID.

        I move the setting of the RedirectURL until after I get that response, populate appropriately, and then execute the redirect.

        ------------------------------
        Ryan Stanford
        ------------------------------