Answers.Body: <p>So the work around was to convert the Neo field to a Matrix. That worked for this instance since we're not storing anything complex but I'd sure like to figure out if/how Neo supports mutations.</p>
  <pre><code>mutation addRecipeReview($recipeId: ID, $blocks: [reviews_MatrixBlockContainerInput] = {review: {authorEmail: &quot;&quot;, authorName: &quot;&quot;, authorReview: &quot;&quot;, reviewDate: &quot;&quot;, reviewRating: &quot;&quot;}}, $sortOrder: [QueryArgument] = &quot;&quot;) {
    save_recipes_recipe_Entry(id: $recipeId, reviews: {blocks: $blocks, sortOrder: $sortOrder}) {
      id
      reviews {
        ... on reviews_review_BlockType {
          id
          authorEmail
          authorName
          authorReview
          reviewRating
          reviewDate
        }
      }
    }
  }
  
  Variables:
  {
    id: &quot;1234&quot;,
    sortOrder: [&quot;4321&quot;, &quot;4322&quot;, &quot;new:1&quot;],
    blocks: [
      {
        review: {
          authorName: &quot;Author Name&quot;,
          authorEmail: &quot;Author Email&quot;,
          authorReview: &quot;Review&quot;,
          reviewRating: &quot;Rating&quot;,
          reviewDate: &quot;Date Submitted&quot;
        }
      }
    ]
  }
  </code></pre>
  <p>The odd/silly part about the above is that you have to pass in an array of all the existing block IDs to sortOrder, and use the idiom &quot;new:1&quot; for your new block. If you skip the &quot;new:1&quot; it won't add the new block, and if you only pass in &quot;new:1&quot; but omit the existing block IDs it deletes all the existing blocks. You can pass an array of new blocks (the code above only has one) in the 'blocks' array, but you'll have to add &quot;new:1&quot;, &quot;new:2&quot; ... up to how many blocks you have.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-12-29T00:26:34.140Z
Answers.Text: This is the only working example of a matrix mutation I've been able to find. Thank you for posting!
Answers.UserDisplayName: Dalton Rooney
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-03-03T11:53:49.087Z
Answers.Text: Snap! thanks Jon
Answers.UserDisplayName: magicspon
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-12-10T16:23:13.440Z
Answers.LastActivityDate: 2020-12-10T16:23:13.440Z
Answers.UserDisplayName: Jon W
Body: <p>I know how to update simple fields on an entry using a mutation:</p>
  <pre><code>mutation updateRecipe($recipeId: ID, $slug: String) {
    save_recipes_recipe_Entry(id: $recipeId, slug: $slug) {
      id
      title
      slug
    }
  }
  Variables:
  {
    &quot;recipeId&quot;: 8614,
    &quot;slug&quot;:&quot;new-slug&quot;
  }
  </code></pre>
  <p>Is there a way to append a block to a Neo field using mutations? I can retrieve the field data in a GraphQL query but have not found a way to update a Neo field with a mutation.</p>
  <p>Does anybody have any experience implementing this?</p>
  <p>Thanks ...</p>
  
Tags: <craft3><graphql><plugin-neo>
Title: Using a GraphQL mutation to append a block to a Neo field
ThreadText: # Using a GraphQL mutation to append a block to a Neo field
  
  (Asked by: username_0 on 2020-12-09)
  
  I know how to update simple fields on an entry using a mutation:
  
  ```
  mutation updateRecipe($recipeId: ID, $slug: String) {
    save_recipes_recipe_Entry(id: $recipeId, slug: $slug) {
      id
      title
      slug
    }
  }
  Variables:
  {
    "recipeId": 8614,
    "slug":"new-slug"
  }
  
  ```
  
  Is there a way to append a block to a Neo field using mutations? I can retrieve the field data in a GraphQL query but have not found a way to update a Neo field with a mutation.
  
  Does anybody have any experience implementing this?
  
  Thanks ...
  
  **Tags:** craft3, graphql, plugin-neo
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2020-12-10. Score: 4
  
  So the work around was to convert the Neo field to a Matrix. That worked for this instance since we're not storing anything complex but I'd sure like to figure out if/how Neo supports mutations.
  
  ```
  mutation addRecipeReview($recipeId: ID, $blocks: [reviews_MatrixBlockContainerInput] = {review: {authorEmail: "", authorName: "", authorReview: "", reviewDate: "", reviewRating: ""}}, $sortOrder: [QueryArgument] = "") {
    save_recipes_recipe_Entry(id: $recipeId, reviews: {blocks: $blocks, sortOrder: $sortOrder}) {
      id
      reviews {
        ... on reviews_review_BlockType {
          id
          authorEmail
          authorName
          authorReview
          reviewRating
          reviewDate
        }
      }
    }
  }
  
  Variables:
  {
    id: "1234",
    sortOrder: ["4321", "4322", "new:1"],
    blocks: [
      {
        review: {
          authorName: "Author Name",
          authorEmail: "Author Email",
          authorReview: "Review",
          reviewRating: "Rating",
          reviewDate: "Date Submitted"
        }
      }
    ]
  }
  
  ```
  
  The odd/silly part about the above is that you have to pass in an array of all the existing block IDs to sortOrder, and use the idiom "new:1" for your new block. If you skip the "new:1" it won't add the new block, and if you only pass in "new:1" but omit the existing block IDs it deletes all the existing blocks. You can pass an array of new blocks (the code above only has one) in the 'blocks' array, but you'll have to add "new:1", "new:2" ... up to how many blocks you have.
  
  > **Comments:**
  > **username_1**: This is the only working example of a matrix mutation I've been able to find. Thank you for posting!  
  > **username_2**: Snap! thanks Jon  
  
  ---
  
  