How can I add to a list of datetimes in Flows?

How can I add to a list of datetimes in Flows?

cybko
Shopify Partner
41 0 8

I am not sure if this is obvious and I am just being stupid or what, but I just cannot add to a list of datetimes

cybko_0-1709646624104.png

Just gives me this:

Got error updating metafield: "Value is invalid JSON: unexpected token at '-03-05T11:40:16Z'." For value: "2024-03-05T11:40:16Z", Type: list.date_time

 

But works fine on a metafield where it is a single value. So what have I done wrong? I've tried looking at Flows filling list types and I can't see what I am doing differently.

Reply 1 (1)

MARKOSESI
Visitor
1 0 0

No worries, this stuff can be tricky! It looks like the issue might be with how the list of datetimes is formatted. When you’re updating a metafield that expects a list, each item needs to be properly enclosed and separated.

 

For example, instead of just putting 2024-03-05T11:40:16Z, you need to format it as a JSON list. Here's a quick example of how it should look:

JSON - ["2024-03-05T11:40:16Z", "2024-03-06T12:45:30Z"]


Make sure each datetime is within quotes and separated by commas, and the whole list is enclosed in square brackets. This format should work for metafields expecting a list of datetime values.

 

Try updating the metafield with this format and see if it resolves the issue. If you’re still having trouble, double-check that the values you’re adding are correctly formatted and that there are no extra characters.