Create and Update Quotes
Quotes And Related Items
When a quote is created, quote items and attachments can be added. When uploading to the server, we want the Quote and all Quote Items to be created as all or nothing as 1 transaction. If any Quote Items fail to insert, the entire transaction is rolled back. Once the Quote and Quote Items are successfully added, we then upload attachments in parallel in the background. It is possible that the Quote and Quote Items are created but some Attachments may fail to upload, although this is very unlikely.
The reason we upload Attachments as individual request after the Quote and Quote items are created is because there is a 25MB limit on Salesforce API requests. It is possible for a transaction payload to go over this limit (i.e. Quote with 10+ high resolution images). This a very unlikely scenario but the primary action (create Quote and Quote Items) will always be successful.
Attachments can be uploaded one by one once the Quote exists remotely on the server. When the quote doesn't exist remotely yet, attachments can't be uploaded. If attempted, the message: 'Your Quote has not been saved yet. Attachments will be uploaded when you the save the Quote.' will appear.
Attachments that are PDF's can be Emailed to Prospects. This is an option when tapping the ellipses on an Attachment that is a PDF, other file types are not supported for directly emailing to the Prospect.
Quote Item Ordering
- Quote item ordering between mobile and desktop should always match.
- Updating quote item order on mobile and desktop is always in sync
- Numbers should always be sequential, with no gaps. i.e. 1,2,3...
- If quote item 3 goes to 1, 1 becomes 2, and 2 becomes 3
- If quote item 2 is deleted, quote item 3 becomes quote item 2
Quotes require an appointment when updating or creating. When creating a quote from an appointment, the appointment will be read only. This will prevent the user from creating a quote and tying it to a different appointment. When creating a quote from a contact, the appointment drop down will need to be selected. The user will need to select an appointment as it is a required field.
Attachments uploaded on the quote, will be uploaded to the contact.
- Salesforce Provides a composite tree API that allows transactions to be completed. https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_composite_sobject_tree.htm
- Creates one or more sObject trees with root records of the specified type. An sObject tree is a collection of nested, parent-child records with a single root record.
- Up to a total of
200records across all trees, Up to five records of different types
- This allows one Quote to be created and a sum of at most 200 child records. And example would be 190 Quote Items with 10 Attachments to meet the 200 limit. Anything more would result in an error.
- If any of the entities, root item or related child items fails to be inserted, the entire structure fails to be inserted and the transaction roles back.
- This applies for only inserting records (HTTP POST requests). In order to update records, must be done one-by-one.
- Attachments can not be deleted once they are submitted to the server.
- Any errors while inserting for updating will be displayed to the user.
- If any validation rules cause an insert to fail, the entire transaction is rolled back.
- When there are errors on the quote or quote items, the save button will be disabled. When all errors are resolved, the Save button should be re-enabled
- When bulk inserting, updating and deleting items, if one of the operations fails (i.e. adding), it will only show messages from one operation at a time. Thus, if inserting items fail, only errors from inserted will be shown. Once those issues are resolved, then updating errors will show (if any), then deleting. If adding fails, it hold up the updating and deleting processes.
- Since Validation Rules are executed server side, there is no way for the mobile app to determine if the rule has been satisfied. Thus, after an item has been updated, we clear the errors out. When the item is resubmitted, if the validation rule still applies or a new one applies, the errors will be redisplayed
- If one more validation rules fails, all validation rules will be displayed across all items that failed. If 3 quote items each have the same validation rule that fails, the same error message will be displayed 3 times, one for each quote item.
- Sample validation rule: Add a validation rule to Quote Items that quantity must be greater than 0.
- Test validation rules on:
- Creating a new quote, add two quote items with negative quantities. Two error message should show. Correct the error and save.
- Update a quote by adding new quote items and updating existing quote items that cause the validation rule to fail. Correct the issues and make sure can save updating the quote.
- Note that you will only seeing the validation rules for adding first. Once the adding operations are fixed, you will see the validating rules for updating.
- Ensure can create and update quotes after more than one validation rule across many items happens.