Opportunity product and quote product relationship - CRM 2011

Proposed Answer Opportunity product and quote product relationship - CRM 2011

  • Monday, June 18, 2012 10:30 AM
     
     

    Hi All,

    I am looking to establish a link betweeen Opportunity product and quote product. After having that i need to write a plugin to delete the opportunity product if it is deleted from the quote.

    Firstly I wasn't able to create a custom lookup field of entity opportunity product??I was planning to map it to opportunity product ID and use it as 'where' in my query.

    There are no mappings between them. Can any please one suggest how we can achieve this.

All Replies

  • Monday, June 18, 2012 12:20 PM
     
     Proposed Answer

    if the quote is created from the opportunity. it will have a reference to the opportunity.

    from the quote product get the quote id and productid

    based on the quote id get the opportunityid

    based on the opportunityid and productid get the opportunity product now you can delete the opportunity product.

    check a tutorial on reating plugins

    http://www.mscrmshop.blogspot.com.au/2012/01/step-by-step-plugin-tutorial-using.html

    I hope this helps.


    If you find this post helpful then please "Vote as Helpful" and "Mark As Answer". Amreek Singh Senior CRM Consultant CDC Praxa Sydney, Australia http://mscrmshop.blogspot.com http://crm2011usersettings.codeplex.com

    • Proposed As Answer by Amreek Singh Monday, June 18, 2012 12:21 PM
    •  
  • Monday, June 18, 2012 4:00 PM
     
     

    HI Amreek,

    Thank you for your reply. Filter with productid may work fine with existing products but what about the writein-products?

  • Monday, June 18, 2012 11:23 PM
     
     Proposed Answer

    Hi CRMizer,

    One way you can do this is by creating a mapping entity (custom entity) that holds a lookup to both Opportunity Product and Quote Product.

    Then, you could write a plugin that listens on Delete of the Quote product, looks up the mapping entity and find the Opportunity Product(s) that mapped to this Quote Product.

    Once you get the list of Opportunity Product(s), your plugin can go through each one and delete it.

    You could also look into setting up the cascading delete between the Quote Product / Opportunity Product and the mapping entity.

    I hope this helps. If my response answered your question, please mark the response as an answer and also vote as helpful.


    Dimaz Pramudya | CSG (Melbourne) | http://www.xrmbits.com | dimaz@xrmbits.com If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"