I’ve been working with custom states more recently and there’s something which feels unintuitive to me. This may seem like a silly question and it is not urgent at all, I would just like to get a better feel for the fundamentals.
First, here’s how my website allows users to generate invoices using custom states;
Step 1. The user fills in line-item inputs (description, price, quantity) and the workflow Creates a new LineItem “Data Type” and then stores the data in a custom state
Step 2. The user fills in invoice inputs (customer, notes etc) and the workflow Creates a new Invoice “Data Type” called saved_invoice. Along with adding the fields for customer, notes etc, I also add
LineItem add list and refer to
_stored_lineitem so that the data held in the custom state is added to the Invoice.
My question relates to the custom states Value.
Let’s break down the above custom states Value.
create-invoice’s (this is the page/group which has the custom state)
_stored_lineitem (this is the custom state)
:plus item Result from Step 1 (Create a new line item)
So, the data which the custom state will hold (the value) will be the
_stored_lineitem PLUS the
Result from Step 1
Why isn’t the value simply
Result from Step 1? It appears that the custom state needs to include itself PLUS the Result from Step 1. Can anyone explain why it must include itself?