Creating, editing, or deleting data actions - AWS App Studio

AWS App Studio is in preview and is subject to change.

Creating, editing, or deleting data actions

Data actions are used in applications to run actions on an entity's data, such as fetching all records, or fetching a record by ID. Data actions can be used to locate and return data matching specified conditions to be viewed in components such as tables or detail views.

Creating data actions

Tip

You can press CTRL+Z to undo the most recent change to your entity.

  1. If necessary, navigate to the entity for which you want to create data actions.

  2. Choose the Data actions tab.

  3. There are two methods for creating data actions:

    • (Recommended) To use AI to generate data actions for you, based on your entity name, fields, and connected data source, choose Generate data actions. The following actions will be generated:

      1. getAll: Retrieves all the records from an entity. This action is useful when you need to display a list of records or perform operations on multiple records at once.

      2. getByID: Retrieves a single record from an entity based on its unique identifier (ID or primary key). This action is useful when you need to display or perform operations on a specific record.

    • To add a single data action, choose + Add data action.

  4. To view or configure the new data action, see the following section, Editing or configuring data actions.

Editing or configuring data actions

  1. If necessary, navigate to the entity for which you want to create data actions.

  2. Choose the Data actions tab.

  3. In Fields configure the fields to be returned by the query. By default, all of the configured fields in the entity are selected.

    You can also add Joins to the data action by performing the following steps:

    1. Choose + Add Join to open a dialog box.

    2. In Related entity, select the entity you want to join with the current entity.

    3. In Alias, optionally enter a temporary alias name for the related entity.

    4. In Join type, select the desired join type.

    5. Define the join clause by selecting the fields from each entity.

    6. Choose Add to create the join.

    Once created, the join will be displayed in the Joins section, making additional fields available in the Fields to Return dropdown. You can add multiple joins, including chained joins across entities. You can also filter and sort by fields from joined entities.

    To delete a join, choose the trash icon next to it. This will remove any fields from that join and break any dependent joins or constraints using those fields.

  4. In Conditions, add, edit, or remove rules that filter the output of the query. You can organize rules into groups, and you can chain together multiple rules with AND or OR statements.

  5. In Sorting, configure how the query results are sorted by choosing an attribute and choosing ascending or descending order. You can remove the sorting configuration by choosing the trash icon next to the sorting rule.

  6. In Transform results, you can enter custom JavaScript to modify or format results before they are displayed or sent to automations.

  7. In Output preview, view a preview table of the query output based on the configured fields, filters, sorting, and JavaScript.

Deleting data actions

Use the following procedure to delete data actions from an App Studio entity.

  1. If necessary, navigate to the entity for which you want to delete data actions.

  2. Choose the Data actions tab.

  3. For each data action you want to delete, choose the dropdown menu next to Edit and choose Delete.

  4. Choose Confirm in the dialog box.