Forum Discussion

JeffRohan's avatar
JeffRohan
Qrew Cadet
3 years ago

Button clicked on new unsaved form

We have a button on a form in Table 1 that when clicked creates a new record in Table 2.  When the button is clicked it also adds a value to a field in Table 2 using the Record ID of Table 1.  

Example:
Button Action:  Table1 button clicked in recordId=109
Results:
a new record is created in Table 1
Table 1 field called DIN with value="temp109".

The odd behavior is that when a new record is opened in Table 1 and the button is clicked we get an error Type=51, non unique value for the DIN field mentioned above.  This is because the record in Table 1 has not been saved so it does not have a recordID and the value written into DIN is "temp'.

The issue then is that the form does not prompt to save the record first before trying to perform the button actions.  If the user enters any data on the Table 1 form and then clicks the button it does prompt to save.  There are workarounds but I was hoping there is some setting I haven't seen yet to force a save first before any button actions are taken.


------------------------------
Jeff Rohan
------------------------------
  • I would have expected the value that would be written would be a zero actually but I think you will find that you will not be able to show the Button in Add mode, because the Record ID does not exist until the record actually gets saved.

    ------------------------------
    Mark Shnier (YQC)
    mark.shnier@gmail.com
    ------------------------------
    • MarkShnier__You's avatar
      MarkShnier__You
      Icon for Qrew Legend rankQrew Legend
      .... but you could certainly create an automation or Pipeline that triggers for example when a record is saved and a certain checkbox is checked and that automation would create the record in table 2.

      ------------------------------
      Mark Shnier (YQC)
      mark.shnier@gmail.com
      ------------------------------
      • JeffRohan's avatar
        JeffRohan
        Qrew Cadet
        Thanks Mark, I am troubleshooting for one of our users and they said that when they clicked save on the form this happened not when they clicked on the button.  There is no way that could be happening so I think I will make the button available only in view, edit mode.  Thanks for the suggestion to perform this functionality pipeline.

        ------------------------------
        Jeff Rohan
        ------------------------------
  • Hi Jeff,

    Another option if you want to avoid this happening is to set the form properties for that field so it only shows up on a view or edit but doesn't show while adding a record. This way people can add records to Table 2 still but only once the Table 1 record is saved. This will help preserve your workflow and prevent confusion since then all the values will be finalized and the record will be saved before someone starts on the next record.

    ------------------------------
    Evan Martinez
    ------------------------------
    • JeffRohan's avatar
      JeffRohan
      Qrew Cadet
      Thanks Evan, good suggestion I will make the button available only in view, edit mode.

      ------------------------------
      Jeff Rohan
      ------------------------------