When a page contains multiple models to be saved, if a failure to save a record on a secondary object fails, the page enters an unusable state and a partial save occurs leaving inconsistent data artifacts.
To reproduce the problem, complete the following steps:
1) Using SkuidCRM, add a validation rule to Opportunity Products as follows:
UnitPrice <= 10
2) Go to Opportunities Tab
3) Choose the global action "Create New Opportunity via Redirect"
4) Input valid values for Opportunity Name, Account, Stage & Close Date
5) Choose a Price Book
6) Add a new product row (if one didn't automatically get added specifying a valid value for all fields making sure to set Sales Price to a value less than or equal to 10
7) Click "Save"
Actual Result:
1) Error message indicating Unit Price must be greater than 10 is displayed
2) Change Sales Price to a number greater than 10
3) Click "Save"
4) Error message "Invalid Reference ID: OPportunity ID" is displayed
5) If you check the opportunities, the opportunity you created was saved to the database (in Step #7 above) with no line items
Expected Result:
1) After clicking "Save" the first time, error message about Unit Price validation should appear but Opportunity should not be saved to database
2) After adjusting Sales Price to greater than 10, Opportunity & Line Item should successfully save to database
What seems to be occurring:
1) There is currently no transactional control around model saves when multiple models are involved
2) The opportunity saved and skuid reloaded the model on the client with the SFDC Record ID that was assigned prior to proceeding to attempting the Line Item Saves
3) The Line Item Model failed and now contains a bad reference to the temporary "Record ID" that Skuid gave to the new row in the Opportunity model prior to saving the opportunity record. This reference was not updated when the Opportunity was successfully saved above
We have a fairly complex page with several child models all of which have validations that are likely to be triggered. We can't have a user spend a significant amount of time filing out data only to have a validation fail and the user have to abandon all the data entry, go find the data that did save and then re-key all the child data again.
1) Is there a way to enforce transactional control on model saves? This is the preferred method/solution and something we'd like to see in the future for Skuid if it isn't already possible.
2) Short of that, is there a way to solve for ensuring the child models get updated references when partial saves complete?
Thank you!
To reproduce the problem, complete the following steps:
1) Using SkuidCRM, add a validation rule to Opportunity Products as follows:
UnitPrice <= 10
2) Go to Opportunities Tab
3) Choose the global action "Create New Opportunity via Redirect"
4) Input valid values for Opportunity Name, Account, Stage & Close Date
5) Choose a Price Book
6) Add a new product row (if one didn't automatically get added specifying a valid value for all fields making sure to set Sales Price to a value less than or equal to 10
7) Click "Save"
Actual Result:
1) Error message indicating Unit Price must be greater than 10 is displayed
2) Change Sales Price to a number greater than 10
3) Click "Save"
4) Error message "Invalid Reference ID: OPportunity ID" is displayed
5) If you check the opportunities, the opportunity you created was saved to the database (in Step #7 above) with no line items
Expected Result:
1) After clicking "Save" the first time, error message about Unit Price validation should appear but Opportunity should not be saved to database
2) After adjusting Sales Price to greater than 10, Opportunity & Line Item should successfully save to database
What seems to be occurring:
1) There is currently no transactional control around model saves when multiple models are involved
2) The opportunity saved and skuid reloaded the model on the client with the SFDC Record ID that was assigned prior to proceeding to attempting the Line Item Saves
3) The Line Item Model failed and now contains a bad reference to the temporary "Record ID" that Skuid gave to the new row in the Opportunity model prior to saving the opportunity record. This reference was not updated when the Opportunity was successfully saved above
We have a fairly complex page with several child models all of which have validations that are likely to be triggered. We can't have a user spend a significant amount of time filing out data only to have a validation fail and the user have to abandon all the data entry, go find the data that did save and then re-key all the child data again.
1) Is there a way to enforce transactional control on model saves? This is the preferred method/solution and something we'd like to see in the future for Skuid if it isn't already possible.
2) Short of that, is there a way to solve for ensuring the child models get updated references when partial saves complete?
Thank you!