FLOW to retrieve file url from a custom field

Topic summary

A user is attempting to retrieve a file URL from a custom field in Shopify Flow to email customers after order fulfillment. They’ve uploaded PDFs to orders via the back office and want to include download links in automated emails.

Current Issue:

  • The provided code snippet only returns the GenericFile GID (identifier), not the actual file URL
  • The code loops through order metafields and references but cannot access the file URL directly

Response & Workaround:

  • Direct access to GenericFile URLs is not currently supported in Flow
  • A potential workaround involves looping through the “fields” list within references to find the key/value pair, though results are uncertain without additional testing
  • Shopify has an ongoing project to improve metafield access in Flow, which should simplify these use cases in the future

Status: Unresolved - no confirmed solution available with current Flow capabilities.

Summarized with AI on November 12. AI used: claude-sonnet-4-5-20250929.

Hi, beautiful community.

I try to retrieve the URL of a file uploaded into an order.
In particular, through the back office, before fulfilling an order it’s possible to add a PDF to the order.
When the order is fulfilled a Flow trigger starts and I would like to send an email to the customer with the URL (link) of the document.
I use this code to retrieve the custom field (type File) that contains the file:

{% for metafields_item in order.metafields %}
  {% for references_item in metafields_item.references %}
    Certificazione : {{references_item.GenericFile.url}}
{% endfor %}
{% endfor %}

Copy

But the result is the GID of the file:

gid://shopify/GenericFile/3682400822916

Any ideas?

Thanks,

Fernando

I already answered this question elsewhere. You cannot access the “GenericFile” like that yet in Flow.

You might be able to loop over the “fields” list in the reference to find the key and value for that field. I’m not sure what that will return in this use case without additional testing.

We do have a project underway to improve how you access metafields in Flow, which will make use cases like this much easier.