locked
Opportunity Products to Quote Products - similar functionality to another entity RRS feed

  • Question

  • Hello Everyone,

    I'm looking to basically replicate the functionality between the Opportunity and the Quote and how the opportunity products are automatically created and mapped over to the quote products on the quote. I have a custom entity where the products from the opportunity should be created as commission products. When I create a commission record I want commission products to be mapped over/created from the opportunity. Basically the same exact functionality that is out of the box between opportunity products and quote products.

    Is something like this possible to do? How difficult is it? And do you have any suggestions or helpful articles with examples if so?

    Thanks a bunch!

    Thursday, September 12, 2013 1:47 PM

Answers

  • This would certainly be possible with some custom .Net code in the form of a plugin using the SDK on create of your Commission entity. Based on the related opportunity it would have to read the Opportunity Products and create new Commission Products for each. The process would be a bit much to get into here but this blog post might help you out:

    Cloning a Record in Dynamics CRM 2011

    Additionally once the Commission Products are all created you could add in additional code to roll up any totals to the Commission main record. If you wanted to maintain this total when Commission Products are updated - you would need to create plugins for Create, Update, Delete, etc...  to re-tally any values when those records change. 

    Overall to fully replicate the functionality you are looking for is a fair amount of work but doable.


    Jason Lattimer
    My Blog -  Follow me on Twitter -  LinkedIn

    Thursday, September 12, 2013 2:44 PM
    Moderator
  • Opportunity and product have many to many relationshi[p which is broken down by Opportunity Products therefore three entities are involved here. Same way you can create Commission and Commission Products as custom entities and relate Commission Products with Products. Code will be required to rollup totals from Commission Products to Commission entity.

    OPTION 2: You have another option here. Create an entity of commissions and relate it will opportunity product. Commission will be parent entity and Opportunity product will be child. There will be lookup field of commissionid created as a result of this relationship. Now whenever you want to create commission record, fetch all the opportunity products and update the commissionid field with the GUID of commission. As the Opportunity products will be related to commission therefore you can show them in a grid under commission. Rollup the commission from Opportunity product to commission entity.


    Regards Faisal

    Thursday, September 12, 2013 3:12 PM
  • Assuming you code to 2011 standards you should be OK when updating to 2013 (should be minimal updating of any). 

    Jason Lattimer
    My Blog -  Follow me on Twitter -  LinkedIn

    Thursday, September 12, 2013 3:34 PM
    Moderator

All replies

  • This would certainly be possible with some custom .Net code in the form of a plugin using the SDK on create of your Commission entity. Based on the related opportunity it would have to read the Opportunity Products and create new Commission Products for each. The process would be a bit much to get into here but this blog post might help you out:

    Cloning a Record in Dynamics CRM 2011

    Additionally once the Commission Products are all created you could add in additional code to roll up any totals to the Commission main record. If you wanted to maintain this total when Commission Products are updated - you would need to create plugins for Create, Update, Delete, etc...  to re-tally any values when those records change. 

    Overall to fully replicate the functionality you are looking for is a fair amount of work but doable.


    Jason Lattimer
    My Blog -  Follow me on Twitter -  LinkedIn

    Thursday, September 12, 2013 2:44 PM
    Moderator
  • Opportunity and product have many to many relationshi[p which is broken down by Opportunity Products therefore three entities are involved here. Same way you can create Commission and Commission Products as custom entities and relate Commission Products with Products. Code will be required to rollup totals from Commission Products to Commission entity.

    OPTION 2: You have another option here. Create an entity of commissions and relate it will opportunity product. Commission will be parent entity and Opportunity product will be child. There will be lookup field of commissionid created as a result of this relationship. Now whenever you want to create commission record, fetch all the opportunity products and update the commissionid field with the GUID of commission. As the Opportunity products will be related to commission therefore you can show them in a grid under commission. Rollup the commission from Opportunity product to commission entity.


    Regards Faisal

    Thursday, September 12, 2013 3:12 PM
  • Hey guys, thank you both for your response. This will give me a good place to continue my thought process. I have one follow up question, would taking the time to develop all this be worth it if we are planning to update to CRM 2013 sometime early next year?

    Option 2 is intriguing because it seems to involve less coding which I'm not the strongest at. However, it'd have to be a many to many relationship. I'd have to have many commission records that could have many products and vise verse because I may have 1 sales guy on the sale or 5. Each person would have their own commission record to calculate their unique percentage of the sale. Currently I have the opportunity which could have many sales split entities which then has many sales commission line items. Sales split defines how many sales guys are on the sale and the rules for what the commission percentage. Then the commission line items reference the sales split, the commission line items have to be manual entered, because not all products are commissionable. I'd have to declare which products with which units are commissionable and then only create those as commission line items when a sales split is created. Having to manually create the commission line item and enter the dollar amount apparently isn't acceptable and is to much work. They want a one click button that when opportunity closes everything is mapped created and calculated and a report is ran with what each sales rep earned in commission.

    Thanks again guys.

    Thursday, September 12, 2013 3:29 PM
  • Assuming you code to 2011 standards you should be OK when updating to 2013 (should be minimal updating of any). 

    Jason Lattimer
    My Blog -  Follow me on Twitter -  LinkedIn

    Thursday, September 12, 2013 3:34 PM
    Moderator
  • You can relate Commision with only those Opporunity products which are commissionable.  After getting further requirements I think the commissions/Opportunity products should also be linked with the user record so that you should also know who has got commission, on which products, how much and when. You can make it a clickless move by running the plugin when an opportunity is won. However, you should also consider one thing that not all won opportunities results in sale. Therefore commission should be paid to user when the invoice has been paid. In case anything happens during quote order or invoice stage and sale is not successful then you will have to adjust the commissions.


    Regards Faisal

    Thursday, September 12, 2013 4:25 PM
  • I have thought about declaring whether the product is commission able or not on the product entity. And when the product is selected on the opportunity product to bring that value over, yes/no. My current commission line item entity references the owner because the owner record contains the commission rate for that user. Each user has a different commission rate based on previous Quarter performance, I have tied this in to be updated by workflows from the Goal entity. So when a new commission line item record is created based on the user their commission rate is populated on the commission line item entity. Where I run into issues is having multiple people on one sale that get a split of each commissionable item. On top of that the total sale amount is not the commissionable amount. Some items may not get paid commission on until a year later, if the account is a current client or not changes the communion value, besides the base commission rate of the owner there are about 5 or 6 different rules that could change the rate up or down. I was able to code all these in but not to the point where 1 click creates all the records and calculates the values.

    To address not all won opportunities are closed in our case they are. A sales person does not close their opportunities or create Quotes (we have no set pricing for any products so sales cannot create quotes we use opportunites to set upa request and then someone else creates the quote on the quote entity using mail merge and attaches a pdf of the quote back to the opportunity . When we get the signed contract we close the Quote which automatically closes the opportunity as won as well. A signed contract has always been the trigger to pay out the commissions even before we had CRM. No matter which solution I run into cases where there will have to be user input. The split of the sale is a difficult one to map throughout. It is never the same and can be any percentage between any number of sales reps totally 100% of the sale. We currently don't use any functionality of the Order or Invoice entities. Other than an Order is created to close the Quote as won which closes out the opportunity.

    Thursday, September 12, 2013 4:55 PM
  • I had another idea of using the Quote Products as the Commission products instead of the opportunity products. That way the initial entity can be created from the Opportunity the sales reps can create that initial record that holds their split value. Once the Quote is closed all values are mapped over and each commissionable quote product is created on the sales split record. The one question and issue I see is how would I code the lookup for the opportunity quote back to the sales split record that was created from the opportunity? The quote relationship has a lookup back to the opportunity that looks up to the sales split but how would i check to see if I needed to recreate the quote product 1 time for 1 sales rep or 5 times for 5 different sales reps.
    Thursday, September 12, 2013 5:38 PM
  • You can use quote entity if you are sure that company is never going to use this entity for generation of quotes. You will get another issue that all  opportunity products will be converted to quote product whether they are commissionable or not. I think you should create a commission entity and make it a child entity of Opportunity product. Commission entity will have a lookup of user. Now based on commissionable products you can create multiple records for commission and give them to different sales rep.

    Regards Faisal

    Friday, September 13, 2013 1:56 PM
  • What I ended up doing was on the product entity declaring if the product was a commissioned product or not. When an opportunity record is created the code triggers on change of the unit. When the unit is changed it checks if the product and unit combination is commissionable. If so a check box is checked yes. Then on creation of Quote when the Opportunity Products are converted to Quote Products it maps over that value to another check box on the Quote Product pages. Then I added the same code to the Quote product in case at a later date additional products are added to the Quote but not the Opportunity, because we do use the Quote entity and mail merge to generate our proposals we send out.

    Then I thought about creating the many to many relationship with the commission entity and I could simply have the subgrid on the commission form with a filter to only show quote products with commissionable check box checked yes. Then I could run calculations from the values in the subgrid. What I don't know how I would do is to populate that many to many relationship between the quote products and commission entity. So that when the Quote is closed as won (order created) all quote products are now related to each commission record regarding the same opportunity.

    Then the next issue I would run into is from a subgrid I would be calculating commission from a sum of a subgrid. Which would be fine if it were that simple but every product and every line item on a quote could be commissioned anywhere from 0.5% - 6%. The rules for commission rate and when its paid are very hazy and unclear yet when a Quote is closed the system is supposed to magically calculate everything run a report and the 60 hrs a month spent on commissions goes to 5 minutes.

    I am not the best coder nor do I know this system's back end very well so I get creative with how I move data around and get it to the places I need too. I'm assuming there is some kind of create record loop I could code that would check for each commission record regarding an opportunity and create all quote products for each commission record. Also they don't want to use the opportunity because sales can enter numbers there, the quote is the final number that match the signed contract so they want the quote products used because they don't trust their sales team to enter numbers accurately or not to try give themselves higher commission rates.

    Friday, September 13, 2013 2:30 PM