Model Actions

Model actions allow you to trigger a sequence of Action Framework actions that run automatically when model-level events occur. This means the actions don’t need to be tied to a button or intentionally activated by the end-user, but are activated “behind the scenes” when specific things happen on the page. Model actions are useful for creating simplified, automated workflows, even for complex processes.

Create a Model Action

  1. In the Elements pane, click the Models tab.
  2. Click the model name.
  3. Below the model name, click Actions.
  4. Click fa-plus-circle Add to create a new model action.
    • Set initiating events (and properties of those events) in the Initiating Events tab.
    • Add specific action framework sequences using the Actions tab.
  5. Click Save.

Using Model Actions

The following are a couple examples where model actions create a streamlined user experience.

Update Roll-up Summaries [[]]

The situation

A Table component connected to on an object that collects sales opportunities. The table displays:

  • the opportunity by name
  • the account name
  • the amount of the opportunity
  • the close date for the opportunity

Each opportunity has a drawer with a table component where the end user can add products to an “ordered product” list, with fields for the price book ID, quantity of the product, sales price and total price. The total price is a UI-only field: {{UnitPrice}}*{{Quantity}} This field updates in real time when changes are made to the quantity or the sales price.

The challenge

End user would like to see the amount on the opportunity table automatically update as products are added to the product list—without having to refresh the page.

The model action

Initiating action tab

  • Initiating Event: Row in Model updated
  • When which Field(s) are updated: The UI-only total price field

Action tab

  • Action Type: Query Model
  • Model: The model on the opportunity object.
  • Query Behavior: Standard - Completely Replace Data

Push Data from Ui-Only Fields to Database Fields [[]]

The situation

A Table component connected to on an object that collects sales opportunities. The table displays:

  • the opportunity by name
  • the account name
  • the amount of the opportunity
  • the close date for the opportunity

Each opportunity has a drawer with a table component connected to a products object. Here, the end user can add products to an “ordered product” list. This list includes the following fields:

  • price book ID
  • quantity of the product
  • sales price
  • discount (a UI-only field: {{DiscountUI}})
  • total price (a UI-only field: {{UnitPrice}}*{{Quantity}}*((100-{{DiscountUi}})/100)).
  • Current price

The challenge

Often builders employ UI-Only fields so that end users can see (in real time) how their changes will affect data, for example, how changes in the UI-Only discount field shift the (also UI-Only) total price. But, if the discount is confirmed, then that UI-only total price needs to be pushed back to the actual discount field in the database (not the UI-Only discount field used for the onscreen calculation) when the user clicks Save. This ensures that the agreed-upon discount will be saved to the external system.

The model action

Initiating action tab

  • Initiating Event: Row in Model updated
  • When which Field(s) are updated: The UI-only discount field

Action tab

  • Action Type: Update a field on row(s)
  • Model: The model on the products object
  • Field: The discount field in the products object
  • Value: {{DiscountUi}}

Properties

Initiating Events tab [[]]

Initiating events are changes to Skuid models that begin a sequence of Action Framework actions. Click fa-plus-circle Add to create a new model action, then select the initiating event for it:

  • Initiating Event(s)

    • Model saved: When the model is saved, whether as the result of user input or an Action Framework action.

    • Model requeried: When the model is queried, which can occur on page load or by an Action Framework action.

      Note

      This event is published on page load—regardless of the model’s Query on Page Load property value—because Skuid must retrieve the model’s metadata.

    • Model cancelled: When changes to the model (as the result of user input or an Action Framework action) are cancelled.

    • New row created in Model: When a new data row is added to the model, as the result of user input or an Action Framework action.

    • Row in Model updated: When one or more fields are updated as the result of user input or an Action Framework trigger. You may select whether this initiating event applies to specific fields or to all fields in the model.

    • Row in Model marked for deletion: Marks the selected row on the model for deletion as the result of user input or an Action Framework trigger.

    • Row in Model un-marked for deletion: Unmarks the row on the model selected for deletion as the result of user input or an Action Framework trigger.

    Changes to model conditions can also be selected as initiating events.

  • Model Condition changed: If the value of a model’s condition changes (even in the background, unactivated).

  • Model Condition activated: When a model’s condition is activated, whether or not the model affected by it has been requeried.

  • Model Condition deactivated: When a model’s condition is deactivated, whether or not the model affected by it has been requeried.

  • Model Condition reset: When the condition’s value is reset. This can only be done through Skuid’s JavaScript API.

    • When which conditions are changed? For each of the previous condition-related events, select trigger to begin the sequence. Options include:
      • Any filterable condition
      • One or more named conditions.

Actions tab [[]]

Select the model actions:

  • Actions:
    • Add Action: Click fa-plus-circle to add actions and set them.
    • Convert to Action Sequence: Click fa-sitemap to establish an action sequence.
      • Display Name: Give the sequence a memorable name.
      • Description: Describe the goal or purpose of the sequence.
  • Action Type: Use the Action Framework to create actions.