Can I "save" models client side and then later on commit save to server?

  • 2
  • Question
  • Updated 3 years ago
We've got a wizard that we want to use on a public site that will let a user create a custom object Entity Formation and one or more related contacts. I'd like to be able to create the custom object and "save" it so that the field values are not italicized, and then create one or more contacts and do the same thing, but then not actually create these records in Salesforce unless they hit a Submit button at the end. Is that possible? 

I was reading this post about dynamic model creation and think it may hint at some answers... https://community.skuidify.com/skuid/topics/saving-dynamic-model-doesnt-update-server
Photo of Jack Sanford

Jack Sanford, Champion

  • 8,322 Points 5k badge 2x thumb

Posted 3 years ago

  • 2
Photo of Jack Sanford

Jack Sanford, Champion

  • 8,322 Points 5k badge 2x thumb
So, I got it working well enough for me, just didn't save anything until Step 7 of the wizard, where I have a "Validate Data" button. That button does two actions - it saves the Entity, at which time any required fields that are empty throw an error, and then it saves the Contact, and also throws errors if there are required fields missing.

I had to break out the saves into two separate actions, not sure exactly why but it worked smoother that way, I think because the contact required that the Entity object be real so that the lookup field on the Contact connected to something. 

Then once there are no unsaved changes in both of my models, the Submit button is rendered, which does the redirecting I want. 
Photo of Anna Wiersema

Anna Wiersema

  • 10,890 Points 10k badge 2x thumb
Thanks for sharing the solution, Jack.  Yeah, that sounds like the reason you had to do the saves separately... even if the Entity model is before the Contact model, if they're being saved in the same action, I feel like Skuid tries to save them both at once, which causes problems saving the new Contact.