Is anyone else experiencing issues with variables in Flow that were part of workflows already wrking

Solved

Is anyone else experiencing issues with variables in Flow that were part of workflows already wrking

helenaBee
Shopify Partner
4 0 1

After the last update, all my workflows started experiencing problems. Eg. 

This code was working perfectly, and now has a message "productIdsArray" is invalid. Replace this variable.

 
The variable was perfect before. 
 
Does anyone know what could be wrong? This is not an isolated case, it's happening in all our flows
 
CASE: METAFIELDS SET MUTATION
"UPdate metafield with metaobject value"
 

{% assign validIds = "" %}

{% assign id = getProductDataForeachitem.vendorCollectionMetaobject.value.brandOwnedBy.referenceProductMetaobject.system.id %}
{% if id and id contains "gid://shopify/Metaobject/" %}
{% assign validIds = id %}
{% endif %}

{% for peopleValues_item in getProductDataForeachitem.vendorCollectionMetaobject.value.peopleValues %}
{% assign id = peopleValues_item.referenceProductMetaobject.system.id | strip %}
{% if id and id contains "gid://shopify/Metaobject/" %}
{% if validIds == "" %}
{% assign validIds = id %}
{% else %}
{% assign validIds = validIds | append: "," | append: id %}
{% endif %}
{% endif %}
{% endfor %}

{% for planetValues_item in getProductDataForeachitem.vendorCollectionMetaobject.value.planetValues %}
{% assign id = planetValues_item.referenceProductMetaobject.system.id | strip %}
{% if id and id contains "gid://shopify/Metaobject/" %}
{% if validIds == "" %}
{% assign validIds = id %}
{% else %}
{% assign validIds = validIds | append: "," | append: id %}
{% endif %}
{% endif %}
{% endfor %}

{% for productSustainability_item in getProductDataForeachitem.vendorCollectionMetaobject.value.productSustainability %}
{% assign id = productSustainability_item.referenceProductMetaobject.system.id | strip %}
{% if id and id contains "gid://shopify/Metaobject/" %}
{% if validIds == "" %}
{% assign validIds = id %}
{% else %}
{% assign validIds = validIds | append: "," | append: id %}
{% endif %}
{% endif %}
{% endfor %}

{% for productManufacture_item in getProductDataForeachitem.vendorCollectionMetaobject.value.productManufacture %}
{% assign id = productManufacture_item.referenceProductMetaobject.system.id | strip %}
{% if id and id contains "gid://shopify/Metaobject/" %}
{% if validIds == "" %}
{% assign validIds = id %}
{% else %}
{% assign validIds = validIds | append: "," | append: id %}
{% endif %}
{% endif %}
{% endfor %}

{% assign id = getProductDataForeachitem.vendorCollectionMetaobject.value.productChemicals.referenceProductMetaobject.system.id %}
{% if id and id contains "gid://shopify/Metaobject/" %}
{% if validIds == "" %}
{% assign validIds = id %}
{% else %}
{% assign validIds = validIds | append: "," | append: id %}
{% endif %}
{% endif %}

{% for productBlends_item in getProductDataForeachitem.vendorCollectionMetaobject.value.productBlends %}
{% assign id = productBlends_item.referenceProductMetaobject.system.id | strip %}
{% if id and id contains "gid://shopify/Metaobject/" %}
{% if validIds == "" %}
{% assign validIds = id %}
{% else %}
{% assign validIds = validIds | append: "," | append: id %}
{% endif %}
{% endif %}
{% endfor %}

{% assign id = getProductDataForeachitem.vendorCollectionMetaobject.value.productContent100.referenceProductMetaobject.system.id | strip %}
{% if id and id contains "gid://shopify/Metaobject/" %}
{% if validIds == "" %}
{% assign validIds = id %}
{% else %}
{% assign validIds = validIds | append: "," | append: id %}
{% endif %}
{% endif %}

{% assign productIdsArray = validIds | split: "," %}

{% if productIdsArray == blank %}
{% assign productIdsArray = "[]" %}
{% endif %}

 

{
"metafields": [
{
"ownerId": "{{getProductDataForeachitem.id}}",
"namespace": "custom",
"key": "all_product_values",
"value": "{{ productIdsArray | json }}",
"type": "list.metaobject_reference"
},
{
"ownerId": "{{getProductDataForeachitem.id}}",
"namespace": "custom",
"key": "inherited_metafields_check",
"value": "TRUE",
"type": "boolean"
}
]
}

 
Accepted Solution (1)

RPiii
Shopify Staff
138 25 40

This is an accepted solution.

This was caused by a bug in how Flow interprets Liquid (specifically `assign`) that has since been resolved. Please let us know if you experience this issue again.

View solution in original post

Replies 4 (4)

Koennn
Excursionist
37 0 40

Hello HelenaBee,

 

I am experiencing similar issues and did not find a solution yet. My flows include a piece of liquid code that ran fine for months, and started to give errors recently. I cannot save the flow anymore without solving this issue, but I don't know how to fix it.

 

It looks like the {% assign %} tag combined with a date variable is causing issues, as code that does not have that combination seems to be unaffected. My liquid code:

 

{
  "phoneNumber": "{{getOrderDataForeachitem.customer.phone}}",
  "data":
     {
     "firstName": "{{ getOrderDataForeachitem.customer.firstName|default:' ' }}",
          "taal": "{{getOrderDataForeachitem.customer.locale | slice: 0, 2 }}",
     "orderId": "http://mijnkast.mublio.nl/orders/{{getOrderDataForeachitem.id | split: '/' | last }}",
     "installatieDatum": "{{ getOrderDataForeachitem.installatie.value | date: '%e/%m/%Y' }}",
     "installatieTijdvakStart": "{% assign travelTimeInS = getOrderDataForeachitem.reistijd.value | date: '%s' %}{% assign travelTimeInSHalf = travelTimeInS | divided_by: 1800 %}{% assign travelTimeInSHalfRound = travelTimeInSHalf | ceil | times: 0.5 | times: 60 | times: 60 %}{% assign startInS = getOrderDataForeachitem.installatie.value | date: '%s' %}{{ startInS | plus: travelTimeInSHalfRound | plus: 7200 | round | date: '%k:%M' }}",
    "installatieTijdvakEind": "{{ startInS | plus: travelTimeInSHalfRound | plus: 7200 | plus: 7200 | round | date: '%k:%M' }}",
"installatieReistijd": "{{ getOrderDataForeachitem.reistijd.value | date: '%s' | plus: 7200 | date: '%k:%M' }}",
"installatieTijd": "{{getOrderDataForeachitem.installatieTijd.value | round | plus: 1 }}",
"installatieMinVier": "{% assign installatieMinVier = getOrderDataForeachitem.installatie.value | date: '%s' %}{{ installatieMinVier | minus: 2419200 | date: '%e/%m' }}"
     }
}

 

Error message: "installatieMinVier" is invalid. Replace this variable.

 

I have many other flows with this issue, I can send examples.

 

@paul_n Do you have a clue what's going on here?

 

Kind regards,

Koen

RPiii
Shopify Staff
138 25 40

This was caused by a bug in how Flow interprets Liquid (specifically `assign`) that has since been resolved. Please let us know if you experience this issue again.

RPiii
Shopify Staff
138 25 40

This is an accepted solution.

This was caused by a bug in how Flow interprets Liquid (specifically `assign`) that has since been resolved. Please let us know if you experience this issue again.

Koennn
Excursionist
37 0 40

Confirmed, the code now works again. Thanks!