[ { "label": "Send Email with Customer Account Fields data when a new Customer is Created", "trigger_type": [ "customer_created" ], "object_type": "customer", "app_id": "triggers", "settings": { "condition_groups": [ { "conditions": [], "actions": [ { "type": "email", "settings": { "wait": "0", "custom_wait": "", "check_date": [], "to": "{{ shop.email }}", "cc": "", "bcc": "", "reply_to": "", "subject": "New Customer", "plain_text": "0", "body": "Name:<\/strong>{{ customer.first_name }} {{ customer.last_name }}\r\n

\r\nDefault Address:<\/strong>
\r\n{{ format_address(customer.default_address, {format: 'html', country: true, company: false, phone: false}) }}\r\n

\r\nField Values in Client Account Fields:<\/strong>

\r\n{% set ignores = ['api_token', ''] %}\r\n\r\n{# Example sort order #}\r\n{% set sort_order = { \r\n\"caf_field_key\":\"Title to Show\",\r\n}%}\r\n\r\n{% set all_keys = customer.metafields.cf_app|keys %}\r\n{% for key in all_keys %}\r\n{% if sort_order[key] is not defined %}\r\n{% set sort_order = sort_order|merge({(key) : ''}) %}\r\n{% endif %}\r\n{% endfor%}\r\n\r\n{% for key, title in sort_order %}\r\n{% if attribute(customer.metafields.cf_app[key], 'value_type') == 'json_string' %}\r\n
{{ title }}<\/strong>\r\n{% set loop = customer.metafields.cf_app[key].value | from_json(true) %}
\r\n{% for key2, val2 in loop %}\r\n{{ key2 | title }}:<\/strong> {{ val2 }}
\r\n{% endfor %}
\r\n{% elseif key not in ignores %}\r\n{{ title != \"\" ? title : key }}:<\/strong> {{ customer.metafields.cf_app[key].value is defined ? customer.metafields.cf_app[key].value : \"N\/A\"}}
\r\n{% endif %}\r\n{% endfor %}\r\n" }, "weight": 999, "target_key": "customer" } ] } ], "shared_workflow_id": 7415 } } ]