Nested Metaobject Mutation help

Shopify Partner
1 0 0

I have a metaobject that has the following structure:


State - Single Line String

Laws - List of MetaObjects of type "Law" 

Notes - List of MetaObjects of type "Note"


My question is how do I construct a mutation and variables to populate the list of Law and Note MetaObjects?


The individual "Law" and "Note" metaobjects have been created and I have their handles.  


Variable definition for the CreateMetaobject mutation:

      capabilities: {
        publishable: {
          status: "ACTIVE"
    type: "stateLawList",
    handle: `${ samHandle.toLowerCase()}`,
    fields: [
            key: "state",
            value: state
            key: "laws",
            value: ??List of Law MetaObjects??
            key: "notes",
            value: ??List of Note MetaObjects??

What should the "value" property look like in my variables passed to the CreateMetaobject mutation???


I tried an array of handles and that was a failure.  Also tried a comma separated list of handles.


Have not tried an array or list of gids.  Or do I need to query each Law and Note and pass the entire metaobject as a field value?  


If the field is defined as a list, can you supply an array of values?  In looking at the documentation it sure looks like the "value" field needs to be a string.  


A bit confused can someone help?










Replies 0 (0)