In this Knowledge Base article you will find guidance on best practices when using the single save function. This content will be updated as additional best practices are identified.
When performing a single save of a record, regardless of whether it is a many-to-many relationship Check Box List usage in an Item View, or using the Update master and detail values when a control raises an event Template the main View’s key field should be cleared or reset before creating new records.
- When loading an item from a List View for editing, ensure that the Load method is executed to ensure that the correct ID is loaded
- When adding new items and planning to create another one, ensure that the ID field is cleared first before entering new data. This ensures no new data will be linked to the wrong parent ID.
- When using the Update master and detail values when a control raises an event Template and the primary key is not visible, add an action on the template to ensure that IDs are created correctly. For example:
- When the create button is clicked
- Clear the primary key field/textbox/etc. Blank data can be transferred into the primary key field, or the Clear method action can be used on the control
- Then execute the create method on the main View (with the relevant mappings)
- Then execute the rest of the methods in a batch
Setup of the Clear action depends on the specific scenario. If you have a List View opening a subform to capture new records, it will automatically be cleared. If you reuse that subform for loading, the necessary record will be loaded so the ID will be correct.
Example of clearing the key field or control:
Add the Clear action as shown below.
When configuring the Clear method, the control is selected on the Output Mappings tab, but no value is populated.