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 rows

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

  • 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 end 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.
  • Named outputs: Re-use the output of the created rows in subsequent actions via the $Output merge variable. The named output will only be available for subsequent actions in this series or sequence of actions.

    If the name of the output is New_Row, then following actions may access these rows using {{$Output.New_Row.<row_number_in_list_of_created_rows>.<field_name>}}.

Add default values [[]]

Use add 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 rows

Update a field on any row in context—or on all rows—with a specified value, the result of a formula, field data from another model, a page/URL parameter value, or a user attribute from the data source’s metadata.

  • Model: The model the action should affect.

  • Rows to update:

    • Rows in context: In this situation, context means any rows selected by the end user are updated with the value.
    • All rows in model: All rows in the model are updated with the value.
  • Named outputs: Re-use the output of the updated field in subsequent actions via the $Output merge variable. The named output is only available for subsequent actions in this series or sequence of actions.

Setting field values

Click Add field to update option from the dots-vertical more options menu to add a field to be updated.

../../../_images/Add-field-to-update.png

Added fields have the following properties:

  • Field: The field on the model to be updated.

  • Field value source:

    • Single specified value:

      • Value: The specific value to place in the field.
    • Result of a formula: The result of the formula entered in this text area will be placed in the selected field.

    • Field from another model:

      • Source model: Select the model containing the desired field.
      • Source field: The field from the source model to place in the selected field.
    • Page/URL parameter value:

      • Parameter: The global page parameter or parameter from the URL to place in the selected field.
    • Salesforce user attribute:

      • Salesforce User attribute: The field from the Salesforce running user attribute to place in the selected field.
    • Data source user attribute:

      • Data source: Select the data source.
      • Data source user attribute: The available data source attribute field the action places in the selected field.

Mark rows 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 end 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 end user.
    • All rows in model: All rows in the model are marked for deletion.

Unmark rows 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 end 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 rows for deletion,” this action can be used to unmark rows in multiple models.

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

Remove rows 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 end user.
    • All rows in model: All rows in the model are removed.
  • Named outputs: Re-use the output of the abandoned rows in subsequent actions via the $Output merge variable. The named output will only be available for subsequent actions in this series or sequence of actions.

    If the name of the output is Abad_Rows, then following actions may access these rows using {{$Output.Abad_Rows.<row_number_in_list_of_abandoned_rows>.<field_name>}}.

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 rows from model, this action can be used to clear multiple models.

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

  • Named outputs: Re-use the output of the abandoned rows in subsequent actions via the $Output merge variable. The named output will only be available for subsequent actions in this series or sequence of actions.

    If the name of the output is Abad_Rows, then following actions may access these rows using {{$Output.Abad_Rows.<model_id>.<row_number_in_list_of_abandoned_rows>.<field_name>}}.

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 models 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.

  • Place rows at…: Determines where the adopted rows appear within the list of model records.

    • Start of model data: Rows are adopted at the top of the target model. Components attached to that model immediately display the adopted rows.
    • End of model data: Rows are adopted at the end of the target model. Components attached to that model may not display the adopted rows depending on how many records are displayed.
  • Rows to use: Select whether this action sends:

    • Rows in context: In this situation, context means any rows selected by the end user.
    • All rows in model: All rows in the model are sent.
  • Named outputs: Re-use the output of the adopted rows in subsequent actions via the $Output merge variable. The named output will only be available for subsequent actions in this series or sequence of actions.

    If the name of the output is Adopt_Rows, then following actions may access these rows using {{$Output.Adopt_Rows.<row_number_in_list_of_abandoned_rows>.<field_name>}}.

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.