Skip to main content
Question

Button clicked on new unsaved form

  • September 15, 2021
  • 0 replies
  • 57 views

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
------------------------------
This topic has been closed for replies.

MarkShnierYou
Forum|alt.badge.img+24
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
------------------------------

Forum|alt.badge.img+17
  • Community Moderator
  • September 20, 2021
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
------------------------------