Get metaobject entries

You can use the Get metaobject entries action to retrieve a list of entries for a metaobject from your store based on the optional query. See the metaobjects documentation for more information.

Configuration

Fields

The Get metaobject entries action contains a dropdown for specifying the metaobject definition as well as the following fields, which are used to build the query:

Fields used in the Get data actions.
FieldDescription
Sort data byRequired. The parameters by which the data returned by the search query is sorted.
Maximum number of resultsRequired. The maximum amount of results that can be returned by the search query that you select. You can return up to 100 at a time.
QueryRequired. Choose from common queries or select Advanced to create your own.

Query String

This is an example query for getting metaobject entries if the value of an email field matches the email address on an order:

{{fields.email}}:"{{order.email}}"

This is an example query for getting metaobject entries that were updated in the last day:

updated_at:<='{{ scheduledAt }}' AND updated_at:>'{{ scheduledAt | date_minus: "1 day" }}'

The updated_at variable is a filter available on the Metaobjects query and can be used multiple times or combined with other variables. The scheduledAt Liquid variable is available on workflows that used the Scheduled time trigger. The date_minus Liquid tag is a special Flow tag that allows you to subtract time from a date.

When querying data, it's helpful to know:

Returned data

All Get data actions return a list of anywhere from 0 and 100 resources. Depending your use case, you might want to use this data in various ways:

  • If you need to handle each list item individually, such as to add a tag for each, then you can use the For each action.
  • If you need to aggregate data, such as count how many results were returned, then you can use the Count or Sum actions.
  • If you need output the list, such as send an email with all the items, then you can use returned data directly in susbsequent actions.

To access the returned data in steps that follow this action, use the variable named Get metaobject entries, which is a list of metaobject entries. You can use this variable in both conditions and actions. For example, you can send the list of key-value pairs for the metaobject entries in a Send internal email action like this:

{% for getMetaobjectEntries_item in getMetaobjectEntries %}
Key-value pairs for entry:
  {% for fields_item in getMetaobjectEntries_item.system.fields %}
    {{fields_item.key}}:{{fields_item.value}}
  {% endfor %}
{% endfor %}

Triggers

You can use this action in any workflow, including the Scheduled time trigger. In a workflow that uses the Scheduled time trigger, the workflow starts at a time that you've specified, rather than as a result of an event. Because there is no specific event in your store or from an app that starts the workflow, there is no data automatically included.

API details

Can’t find the answers you’re looking for? We’re here to help.