Flow Automation: Creating Metafields via Action
In Flow Automation, you can use the Create metafield definition action to automatically create metafields for resources such as products, orders, and customers.
Metafields allow you to store additional custom information about resources, such as care instructions for products or gift messages for orders. With this action, you can schedule the creation of metafields in advance and combine metafield creation with other automated tasks, such as sending team notifications, to reduce manual work and improve operational efficiency.
This guide explains when to use this action, how to configure its fields, compatible workflows, testing methods, and usage limitations, along with a practical workflow example.
| Note: For more information about metafields, refer to "Customizing Your Store Content with Metafields." |
When to Use the Create Metafield Definition Action
You can use the Create metafield definition action in the following scenarios:
- Preparing for marketing campaigns or new service launches: Create the required metafields for products, orders, or customers at a specified time to prepare for upcoming launches.
- Combining multiple automated tasks: Incorporate metafield creation, team notifications, and other actions into a single workflow to reduce manual work and streamline business processes.
| Note: This action only creates metafields. It does not populate metafield values for individual products, orders, or other resources. |
Field Descriptions
The Create metafield definition action allows you to specify the resource type, display name, unique identifier, and data type of a new metafield. You can enter values directly or click + Add variable to reference available data.
The following table describes the required fields:
| Field | Description |
| type |
|
| key |
|
| name |
|
| namespace |
|
| owner_resource |
|
| Note: The table above lists only the required fields for creating a metafield. Configure optional fields as needed based on your business requirements. |
Applicable Workflows
The Create metafield definition action is primarily used in workflows initiated by the following trigger:
- [General] Scheduled time
| Note: For detailed instructions on configuring the Scheduled time trigger, refer to "Flow Automation: Scheduled Trigger." |
Testing the Workflow
To verify that your workflow successfully creates a metafield definition, follow these steps:
- In Flow Automation, create a workflow using the Scheduled time trigger and the Create metafield definition action. Configure the following settings, then click Publish:
- Scheduled time: Set First trigger time to a few minutes from the current time and Repeat or not to Not repeating.
- Create metafield definition: Specify the resource type, name, namespace, key, and data type of the test metafield. Use an easily identifiable name so you can locate and delete it after testing.
-
Once the scheduled trigger time has passed, return to Flow Automation to review the workflow execution results.
Note: For detailed instructions on checking workflow execution results, refer to the "How to View the Running of a Flow" section in the "Introduction to Flow Automation" guide. -
From your SHOPLINE Admin, go to Settings > Customize data. Select the corresponding resource type and verify that the test metafield definition has been successfully created and appears in the list.
Note: For more information about managing metafields, refer to "Customizing Your Store Content with Metafields."
Example Use Case
The following example demonstrates how to use the Create metafield definition action to create a product metafield in advance for a holiday campaign and notify the relevant team.
Scenario: Your store plans to launch a Christmas gift box campaign in mid-December. To prepare for the campaign, you want to automatically create a product metafield named "Holiday Packaging Instructions" at 9:00 AM on December 1 and send an email to your product operations team, reminding them to enter packaging instructions for participating products.
Configure the workflow as follows:
-
Trigger: Scheduled time (starts the workflow at the specified time)
- First trigger time: 2026-12-01 09:00:00
- Repeat or not: Not repeating
-
Action: Create metafield definition
- type: single_line_text_field
- key: gift_wrap_note
- name: Holiday Packaging Instructions
- namespace: holiday
- owner_resource: products
-
Action: Send email
- Subject: Product metafield "Holiday Packaging Instructions" created
- Content: The product metafield "Holiday Packaging Instructions" has been created. Please go to your SHOPLINE Admin, enter packaging instructions for products included in the Christmas gift box campaign, and review the information before the campaign launches.
- Recipient: Email address of the product operations team
Result: At the scheduled time, the workflow automatically creates the product metafield definition and sends an email reminding the product operations team to populate the metafield values. This helps the team complete campaign preparations on time without manually creating the metafield definition or sending a separate notification.
Usage Limitations and Considerations
When using the Create metafield definition action, keep the following rules and limitations in mind:
- Metafield definition uniqueness: Within the same resource type, the combination of namespace and key must be unique. Before creating a metafield definition, ensure that the combination does not duplicate an existing definition.
- Avoiding repeated execution: Once created, a metafield definition remains available for use and does not need to be recreated. To prevent repeated execution, set Repeat or not to Not repeating in the Scheduled time trigger, or deactivate the workflow after the metafield definition has been successfully created.