Can I make a graphQL mutation in Shopify flow "run code" action?

Solved

Can I make a graphQL mutation in Shopify flow "run code" action?

Anthony__P
Tourist
6 0 0

Just curious because I am writing a flow to send an http request to an endpoint to update a metafield on my store but if the "run code" action can do this then it cuts out a lot of extra moving parts.

Accepted Solution (1)

paul_n
Shopify Staff
1336 151 305

This is an accepted solution.

No, it's right in the docs, see limitations and roadmap section: https://help.shopify.com/en/manual/shopify-flow/reference/actions/run-code#limitations

 

 

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.

View solution in original post

Replies 6 (6)

paul_n
Shopify Staff
1336 151 305

This is an accepted solution.

No, it's right in the docs, see limitations and roadmap section: https://help.shopify.com/en/manual/shopify-flow/reference/actions/run-code#limitations

 

 

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
paul_n
Shopify Staff
1336 151 305

That said, why do you need to us that to update a metafield. Flow does have actions for updating metafields.

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
Anthony__P
Tourist
6 0 0

Thank you for the quick response! Really I am trying to update a field on a metaobject. Based on this post linked below, it looks like it is possible to get metaobject values with the run code. I am doing this now so I can send an http request to an app. I was just wondering if I could just update within run code as well it would have made the process a lot simpler.

https://community.shopify.com/c/shopify-flow-app/any-way-to-the-metaobject-values-into-a-flow/m-p/24...

paul_n
Shopify Staff
1336 151 305

Ok. I would continue to use Run code to generate the value you want to update and then use Send HTTP Request to update the metaobject. 

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
tonyricher
Shopify Partner
9 0 1

Hey Paul,
Do you know if Shopify will allow you to do this by the end of September?

 

Improvement Description Estimated Delivery

LoggingUse `console.log` to output data to the Run log for troubleshooting purposes.Done.
External API callsUse JavaScript's fetch to call APIs.Q3 2024
paul_n
Shopify Staff
1336 151 305

I was actually in the middle of updating that page. No, it won't be ready by end of September. We are projecting Q1, 2025 now. That said, we are evaluating multiple options for doing "fetch" that returns data into Flow, some of which could come sooner. Stay tuned. 

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.