Pseudo-Algorithm for DiscardCart
Get the Quote business component.
Get the Id of the current record in the Quote business component:
If Id <> CurrentQuoteId profile attribute, go to step 3;
Else go to step 4.
DiscardCart is being invoked from the eSales - Edit Quote Process, eSales - Order Quote Process, eSales - Modify Order Process, or eSales - Reorder Process workflow. The current record in the Quote business component is the quote being acted upon, and it is not the current quote in the Shopping Cart.
Get another instance of the Catalog business object and the Quote business component, and position the second instance of the Quote business component on the quote record as indicated by the CurrentQuoteId profile attribute. As the first instance of the Quote business component is not being acted upon, from now on Quote means the second instance of the Quote business component.
Set the CurrentQuoteId profile attribute = EMPTY_CART.
Check the field value of [Quote Type]:
If it is Persistent Cart or Anonymous Quote, then delete the record.