Model Data Changes Actions

These actions cover the actual manipulation of data within a model, including adding or deleting rows, updating fields in rows, and accepting or canceling data changes to the model.

Create new row(s)

Used to create new rows within a single model. (Particularly useful for popups.)

  • Model: The model the action should affect.
  • Place row at…: Determines where the new row is placed within the Skuid model:
    • Start of Model data
    • End of Model data
  • Have associated Components initially show this row in…: When the new row is created, it can displayed in the following modes:
    • Edit mode
    • Read mode w/ inline-editing
  • Rows to use:
    • Rows in context: In this situation, context means any rows selected by the user.
      • If using this action (with this option) as mass action, a corresponding new row is created for every selected row.
    • None: A single new row is created.

Add default values [[]]

Use fa-plus-circle Add Default Values on the action item to—as the name implies—add default values to any row created by this action.

After creating the default value,

  • Field: The field to set a default value for.
  • Content: The type of default value set:
    • Single Specific Value: Determines the default value to use within the selected field.
    • None - blank value: Determines that the selected field must be blank. This is commonly used to override model conditions that enforce a specific value on record creation.
  • Value: Enter the default Value for the field.

Note

If the new row (or rows) are created using Rows in context, then use merge syntax in these default values.

Update a field on row(s)

Update a field on any rows in context—or on all rows—with a specified value.

  • Model: The model the action should affect.
  • Field: The field on the model to be updated.
  • Value: The value to place in the selected field.
  • Rows to use:
  • Rows in context: In this situation, context means any rows selected by the user are updated with the value.
  • All rows in model: All rows in the model are updated with the value.

Mark row(s) for deletion

Used to mark one or more rows for deletion within a single model. This does not automatically delete data. Rows marked for deletion must be saved or cancelled, which may occur through user input, or through the Save Model changes action and Cancel Model changes action.

  • Model: The model the action should affect.
  • Rows to use: Select whether this action removes:
    • Rows in context: In this situation, context means any rows selected by the user.
    • All rows in model: All rows in the model are marked for deletion.

Unmark row(s) for deletion

Used to unmark one (or more) rows for deletion within a single model.

  • Model: The model the action should affect.
  • Rows to use: Select whether this action removes:
    • Rows in context: In this situation, context means any rows selected by the user.
    • All rows in model: All rows in the model are unmarked for deletion.

Unmark all rows for deletion

Used to unmark all rows for deletion. In contrast to “Unmark row(s) for deletion,” this action can be used to unmark rows in multiple models.

  • Models: One (or more) models this action should affect.

Remove all rows from Model

Used to completely empty the loaded rows in one or more models. This does not delete data, but rather unloads data from the page. In contrast to Remove row(s) from Mode l, this action can be used to clear multiple models.

  • Models to Empty: One (or more) models this action should affect.

Remove row(s) from Model

Used to remove one or more loaded rows in one individual model. This does not delete data, but rather unloads data from the page. In contrast to Remove all rows from Model, this action provides more granular control to remove specific rows within context.

  • Model: The model the action should affect.
  • Rows to use: Select whether this action removes:
    • Rows in context: In this situation, context means any rows selected by the user.
    • All rows in model: All rows in the model are removed.

Cancel Model changes

Use this action when to prevent edits to data from being saved to the Model.

  • Models to Cancel: The model the action should affect.

Note

Use this action when creating multiple Model changes to ensure data integrity. Why?

Imagine that a user is working on a page and makes a few edits.

They then initiate an Action Framework trigger (for example, a button or a Row Action) that starts a series of actions. One of those actions is Save Models. This means that all the changes—including those made before the user initiated the action trigger—are saved.

Don’t want those earlier updates included in the Save Models action? Then start the action script with Cancel Model changes: this removes all pending changes started before the user activated the Action Framework trigger. Only those changes added after the trigger was selected by the user are saved.

Save Model changes

Save one (or more) Models

  • Models to Save: The model(s) the action saves.
  • Roll back entire save on any error: Check this to rollback any changes made before the error occurred in the save process. This prevents data synchronization issues when a new record (or a partial edit of a record) causes new data to mix with old.

Note

To display a message if there is an error, click fa-plus-circle Add on-error Action. Create an error Message and select a Timeout (seconds) to determine how long the message displays.

Adopt rows into Model

This action transfers rows from a source model into a target model.

  • If the rows adopted from the source model match rows that already exist within the target model, the target model’s rows are updated to match those in the source model.
  • If the rows being adopted do not exist within the target model, then they are added to the model.

This action can be used to adopt saved rows, but it may also be used before saving the source model. Doing so adds any row changes (or new rows) to the target model in Edit mode.

  • Source Model: Select the model to obtain rows from.
  • Target Model: Select the model where rows should be sent and adopted.
  • Rows to Use: Select whether this action sends:
    • Rows in context: In this situation, context means any rows selected by the user.
    • All rows in model: All rows in the model are sent.

Note

This action does not require the use of a follow-on Query Model action.

Warning

Adopting rows from one data object to a different data object often fails or causes unexpected behaviors.