Save and update customer on single form?

Hi guys,

I have a form to Create Customer.

You can then view ‘My Customers’ in a RG and click ‘Edit’ if you want to update any.

When you click Edit, I want to send the User to the same ‘Create Customer’ form (to limit creating too many identical pages) and show the form fields already filled in so that it’s easy to Edit. But of course, the ‘Save’ button workflow created a new Thing, but I’ll need it to Make changes to a Thing if the User is editing.

Is there a way to enable both Create a new Thing AND Make changes to a Thingon the same form? Perhaps I can have two ‘Save’ buttons with different workflows and only show one if the ‘Name’ field is is the DB, but not sure how I add that a constraint to search for something in the DB?

Hi there, @darren.james7518… yes, you can do what you have described. One way to go about it is to put the fields on the form into a group, and set the type of content for the group to Customer. When a customer is being edited, send the Current cell's Customer from the repeating group to the group on the form. Then, use the Parent group's Customer to show existing content in the form’s fields and to know if you should create a new thing (which you will do when the Parent group's Customer is empty) or edit an existing thing (which you will do when it’s not empty, with the thing to edit being the Parent group's Customer, of course).

Hope this helps.


1 Like

That works a charm, thank you!

One final issue on this page:

The form fields correctly display the users details when editing, for example the name field’s ‘initial content’ is Current page customer's first name, but if I go to the ‘Add customer’ page fresh (not editing an existing customer) then I see Lorem Ipsum… in the form field. The placeholder is ‘First name’ but seems to get over ridden if I include the ‘initial content’ Current page customer's first name

How can I ensure that initial view of ‘Create Customer’ form shows the correct placeholder text (First name) AND, if editing then we should see the Current page customer's first name. Not sure how to do this?

Hi @darren.james7518 did you ever figure this out?

Yes I did, are you struggling with it? In your workflow you create a customer but add a condition in the ‘Only when’ field so it knows you are creating a new customer.

Then in the same work flow simply add all the same fields but change the condition in the ‘Only when’ field so it knows you are editing a customer.

Thanks for the update! This is helpful, but I am still struggling with one thing. I have the page with my form on it… and have it setup so that if you navigate to this page and send a thing with it, the form will populate with the thing’s data so you can easily edit it. But if I navigate to this page without sending a thing along with it (ie: to use the form to create a new thing), I get an error in bubble reminding me to send a thing to this page, because this page is expecting a thing.

How do you work around this?

Why would you navigate to your page without sending a Thing? You should send the Thing to the page regardless of if you are using the form to create a new customer or edit an existing one. I may have misunderstood, maybe you can provide a little more content.

The “thing” in my case is a song. If a user needs to “create a new song” I want to navigate them to this page to create it. So in this case, I have no song/thing to send yet… because it is not yet created.

When I have to edit a song/thing, it’s easier. Because I can send that along and life is good.

I think I actually just solved my issue by using URL parameters instead… but it’s not my preferred solution. I’d prefer that you’re able to navigate to a page that accepts a Thing at the page level, but said Thing can be optional.

Phew - Alright I figured this out without using URL params!! Here’s what I did:

  1. Make the form that I can/will to use to do three things: add (create new), edit (edit existing), and copy (use existing data, but create new). I turned this into a reusable element.
  2. I added a “Form Type” custom state to the reusable element. The three options I send it are: new, edit, copy.
  3. I setup a new_thing, edit_thing, and copy_thing page. The new_thing page has NO page-level data… but the copy and edit pages DO have a page-level thing required.
  4. On each of these pages, I have a workflow that triggers on page load to set the “Form Type” custom state based on which page it is.
  5. I handle all other logic in the Reusable element/form. ie:
    a. if custom state = new, the form will be empty and will create a new thing
    b. if custom state = copy, the form will be populated but will still create a new thing
    c. if custom state = edit, the form will update an existing thing

It’s so simple in hindsight, but took me a minute to figure out. So glad I did. Hope this helps others!

Ah yes, well done I think you’ve done it a good way and funnily enough today I am doing something similar. I have a page which holds 3 different Things which each need their own Data source so I will send a “Form Type” (or “Product Type” in my case using a custom state.