Answers.Body: <p>First, get values of existing block and append with values of new block and update with looping neo field blocks one by one.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-07-20T10:34:26.887Z
Answers.LastActivityDate: 2022-07-20T10:34:26.887Z
Answers.UserDisplayName: Kishore Natarajan
Body: <p>I am trying to programatiacally add two new neo blocks to an entry. It works, but it overwrites any manual added blocks that already exists in that entry.</p>
  <p>For context: <br>
  I have an entry with three neo blocks, textModule, imageGallery and logoBlock. So I just want to update the entry with two more blocks, hero and a second textModule.</p>
  <pre><code>'projectBuilder' =&gt; [ // Neo field handle
          'blocks' =&gt; [
            'new0' =&gt; [
              'modified' =&gt; 1,
              'type' =&gt; 'hero', // Neo block handle
              'enabled' =&gt; 1,
              'collapsed' =&gt; 0,
              'level' =&gt; 0,
              'fields' =&gt; [
                'pageHeading' =&gt; &quot;Heading&quot;, // Neo block field
              ]
            ],
            'new1' =&gt; [
              'modified' =&gt; 1,
              'type' =&gt; 'textModule', // Neo block handle
              'enabled' =&gt; 1,
              'collapsed' =&gt; 0,
              'level' =&gt; 1,
              'fields' =&gt; [
                'moduleHeading' =&gt; &quot;Heading&quot;, // Neo block field
                'paragraph' =&gt; &quot;Description&quot;, // Neo block field
              ],
            ],
          ],
          'sortOrder' =&gt; [
            'new0',
            'new1',
          ],
  </code></pre>
  <p>How do I add new blocks to an existing entry without deleting the existing blocks?</p>
  
Tags: <entry><plugin-neo><blocks>
Title: Programatically add new neo blocks without overwriting manually made one
ThreadText: # Programatically add new neo blocks without overwriting manually made one
  
  (Asked by: username_0 on 2022-05-11)
  
  I am trying to programatiacally add two new neo blocks to an entry. It works, but it overwrites any manual added blocks that already exists in that entry.
  
  For context:   
  I have an entry with three neo blocks, textModule, imageGallery and logoBlock. So I just want to update the entry with two more blocks, hero and a second textModule.
  
  ```
  'projectBuilder' => [ // Neo field handle
          'blocks' => [
            'new0' => [
              'modified' => 1,
              'type' => 'hero', // Neo block handle
              'enabled' => 1,
              'collapsed' => 0,
              'level' => 0,
              'fields' => [
                'pageHeading' => "Heading", // Neo block field
              ]
            ],
            'new1' => [
              'modified' => 1,
              'type' => 'textModule', // Neo block handle
              'enabled' => 1,
              'collapsed' => 0,
              'level' => 1,
              'fields' => [
                'moduleHeading' => "Heading", // Neo block field
                'paragraph' => "Description", // Neo block field
              ],
            ],
          ],
          'sortOrder' => [
            'new0',
            'new1',
          ],
  
  ```
  
  How do I add new blocks to an existing entry without deleting the existing blocks?
  
  **Tags:** entry, plugin-neo, blocks
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2022-07-20. Score: 2
  
  First, get values of existing block and append with values of new block and update with looping neo field blocks one by one.
  
  
  ---
  
  