locked
Opportunity product doesn't delete if quote product is deleted in CR 2013 RRS feed

  • Question

  • Hi,

    The CRM 2013 out of the box functioanlity of creating a quote from opportunity works well for any additions and updates. I have a requirement where in after the creation of quote from opportunity, if the quote product (carried over form the opprotunity) is deleted, the same prodcut should be automatically deleted from the opportunity as well.

    Please tell me how to resovle this issue.

    Sunday, December 28, 2014 5:24 PM

All replies

  • There is no mapping between Quote Product and Opportunity Product.

    You can achieve this using Plugin. register a plugin on delete of Quote Product

    Plugin logic will look like ( I have not tried out this logic. But it should work):

    1. Get QuoteId for Quote Product

    2. Retrieve "Opportunity Id" value for above QuoteId

    3. Retrieve All OpportunityProducts for given Opportunity Id ( retrieved at step 2) 

    where "Opportunity Product"."ProductId" == "Quote Product"."Product Id" And

    "Opportunity Product"."UomId" == "Quote Product"."UomId"

    4. Delete all Opportunity Product retrieved at step 3

    Please note that Step 3 is not fool proof as same  product can be added multiple times and it will retrieve all. You can add additional check like Quanity and Discount.

    Also this implicitly assumes that user has delete permission on both Opportunity and Quote. If there is discrepancy in delete permission than this might not work. 

    Monday, December 29, 2014 12:27 PM