I’d like to create a dynamic invoice builder where a user can add line items. The line items will display in a repeating group, and the total amount will be calculated at the end. Then, the user will click ‘create invoice’ and one invoice will be created with all of those line items.
I’m getting a little stuck in that process.
I currently have date type Line Items with fields: line item, quantity, amount, and invoice.
I then have data type invoice with a list of line items.
Yes, add a custom state on the repeating group (or anywhere on the page, really) that is a list of line items. When you create a new line item, add it to the custom state list of line items. When you create the final invoice, make its list of line items the list from the custom state.
To clear out unused line items: When you create the invoice, update the list of line items with the invoice. Like, have a field within your Line Item data type that is for the Invoice. Then, periodically and preferably in a backend workflow, do a search for any line item that doesn’t have an invoice and delete it to keep your database clean.
I’m having trouble getting this to work, and maybe you can help me troubleshoot!
I’ve got the custom state list of line items to display in the repeating group, however everytime I add a new line item, the newest one is the only one that displays in the repeating group.
Workflow is set up to create a new Line Item, then to set the states of the repeating group to custom state items (type: list of Line Items); with the value being Result of Step 1 (create a new Line Item)
The usual disclaimer applies: There are a million ways to do stuff in Bubble, I don’t pretend to have provided perfect answers here, but hopefully this will inspire you to solve what you need to solve.
I followed this - the one only issue is how do we actually control the line item database so after creation the only line item remaining is the one we created?