How to assign a metaobject based on a separate meta field

How to assign a metaobject based on a separate meta field

mns-burg
Excursionist
24 0 2

Hi how do I assign a metafield (metaobject) based on the value of a different metafield with flow and it is doable.

More specfically:
I have a product which have
Meta field A >>>> A to meta field(metaobject).
Meta field B >>>> B to meta field(metaobject).

Meta field C >>>> C to meta field(metaobject).

Meta field E >>>> E to meta field(metaobject).


I know it possible to do if you the following code in value. Just switch the 123 with the Metaobject ID.
" gid://shopify/Metaobject/123 "
However is it possbile to do with a dynamic value (similar to what I have shown in the image below)?

Screenshot 2024-07-13 at 15.31.47.png

 

Replies 5 (5)

paul_n
Shopify Staff
1501 161 350

I'm not following what you data in the existing metafields looks like. I think you want the result to be a metaobject reference. So are you saying that one metafield has a number or string in it this is exactly "123"? Or are you saying that the metafield is a metaobject reference and that 123 part is the ID of the reference (gid://shopify/Metaobject/123)?  

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.
mns-burg
Excursionist
24 0 2

I would like it to make a reference in Metafield(metaobject) based on another content in Metafield(String).
The content in Metafield(String) is the same as the title of the Metafield(metaobject).

I found that gid://shopify/Metaobject/ID will work, but would like if it could be done on the title or handle of the metaobject.
As you can see in the picture/screenshoot I am unsure of what to put in the value to reference a metafield(metaobject).

This might clear up some confusion about the metafields, if that was confusing:
Metafield(Refence) = {{namespace.key.value}}
Metafield(String) = {{product.brand.value}}
Metafield(Metaobject) = {{product.brandbadge.value}}

paul_n
Shopify Staff
1501 161 350

A metaobject reference will always look like that metaobject gid:  gid://shopify/Metaobject/123, that is not changeable. 

 

But if you are trying to get the correct metaobject entry based on the title, I think you would need a way to take the string and use that to lookup the correct metaobject entry. Then you could use that metaobject GID in this action. Flow doesn't yet have a way to do that lookup, so I would stick with ID.  

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.
mns-burg
Excursionist
24 0 2

Do you know if it possible to do without Gid?

paul_n
Shopify Staff
1501 161 350

Don't think so

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.