How do I create a workflow that creates multiple nodes? I'm recreating my pages in Drupal 8 for a platform upgrade. One thing I've identified for this upgrade is the need for a workflow that creates multiple nodes before it's actually finished. If a user creates node of type A, it automatically creates a second node of Type be and auto-fills an entity reference field with whatever nid Node A was given. I'm HOPING this is something I Can create easily, through a form builder or something like that.

I'm not sure what the best option is for this, but I do need to find a way to simplify this workflow. I think I'll need rules a part of it, but I'm not sure at all one way or the other.
Here is a solution I came up with.  Create a custom module and in your MODULENAME.module file implement hook_form_alter to add a custom submit handler MODULENAME_add_story

function MODULENAME_form_alter(&amp;$form, &amp;$form_state, $form_id) { 
  // if creating node of type A (article is machine name)
  if($form_id == 'node_article_form') {
    $form['actions']['submit']['#submit'][] = 'MODULENAME_add_story';
  }  
}


In the custom submit function create the referenced node and save the reference on the original node 

function MODULENAME_add_story($form, $form_state) {

  $article = $form_state-&gt;getFormObject()-&gt;getEntity();
  $aid = $article-&gt;id();
  $uid = $article-&gt;getOwnerId(); 

  // Create node of type B (story is machine name)    
  $story = \Drupal\node\Entity\Node::create([
    'type'        =&gt; 'story',
    'title'       =&gt; 'New auto created story new',
    'uid' =&gt; $uid,
    //set other fields
  ]);
  $story-&gt;save();    

  //set the reference and save
  $article-&gt;field_stories[] = ['target_id' =&gt; $story-&gt;id()];
  $article-&gt;save();
}


So when you create node of type article a node of type story is also created and referenced from article.