Tip #326: Defaulting to “Existing” Opportunity Products

In Dynamics CRM 2013 and 2015, if you use the opportunity line item (opportunity products) subgrid, when you click the + sign, you get the choice to add an existing product or a write-in product.

Screenshot 2015-02-16 20.35.36

But sometimes you don’t want users to use write-in products. If the users must sell something from the price list, the option to use write-in products presents a potential issue, as it can allow users to create unauthorized opportunity products. That is why some CRM implementers decide to remove the standard opportunity product subgrid and add a custom opportunity product subgrid to the form, or display the Opportunity Products navigation bar item.

In CRM 2013, if you create an opportunity product from the navigation bar or a custom subgrid, the Opportunity Products form will open and the “Select Product” two-option field will default to “Existing.” This makes the product lookup available and the write-in product field disabled.

In CRM 2015, users have noticed that if you create an opportunity product from the Opportunity Product form, the “Select Product” field will now default to “Write-in,” which makes the Product lookup field disabled and enables the Write-in product field.

To change this behavior back to the way it used to work, you can use a business rule. Note the “set default’ business rule action will not apply here, as two option fields naturally have a default value. However, you can force the use of existing products with a business rule that changes “Select Product” to “Exisitng” if “Select Product” equals ‘Write-in.”

Screenshot 2015-02-17 07.14.05

Note that this approach effectively prevents users from ever using write-in products.

15 thoughts on “Tip #326: Defaulting to “Existing” Opportunity Products

  1. Hi Joel, how about removing the override opportunity pricing privilege from the user? Is this going to give similar outcome?

  2. Matt Johnson says:

    I raised this with Microsoft a while ago and they typically said it was, “by design”. Not a very good design if you ask me as it’s overriding the default value that’s set for this field.

    Anyway, I got around it using a little bit of javascript in the onload. This way it sets it to Existing when you first go in but you still have the chance to use write in if you want to

    //When the form is first loaded and the product type changes to write-in, change it back to existing
    function ChangeProductType() {
    var writeinField = Xrm.Page.getAttribute(“productdescription”);
    var productOverriddenField = Xrm.Page.getAttribute(“isproductoverridden”);
    if ( (writeinField.getValue() == null) && (productOverriddenField.getValue()==1) )
    //Set to Existing
    //Set to Use Default
    var priceOverriddenField = Xrm.Page.getAttribute(“ispriceoverridden”);

    • Cubalibre says:

      Hi Matt, Your code works but I ‘m left with a red warning image in the WriteIn field label, does it happen to you too?

    • Pieter says:

      Matt, you are my personal hero of the day! We’ve been looking into this for over a month and just couldn’t grasp why this behaviour happened… We turned over every piece of code in our (very elaborate) solution but couldn’t see any mistakes… Turns out one of many changes in default behaviour by Microsoft was causing this…

      Thanks for this little piece of golden code! I am left with the red notification as well, but I feel that this one will be a lot easier to fix 🙂

  3. Andy says:

    That you need to work around this is at all annoying. It’s frustrating that there are features there that should allow you to remove write in products but they don’t work as expect on the grid.

    I want sales to only sell what we have i.e. no write in: but they can sell at the Price they need to – ideally editing the sales price on the grid (not possible)

  4. James says:

    This solution doesn’t quite work for me as even though the ‘Write-In’ field is hidden on the form it still appears with the red and white X symbol next to it even though it is no longer a required field.

    As soon as I click into one of the other fields on the form the X disappears but the Write-In field is still there.

    • Joel Lindstrom says:

      the solutions works, in that it defaults the record to existing and makes the existing product lookup able to be populated (and makes write in read only). In my scenario I still have the write in product field displayed on the form. I agree it isn’t perfect, but it is workable. I recommend you raise this with Microsoft support.

  5. Cubalibre says:

    Matt, I used your code but I get a red warning in the Writein field label, does this happen to you too?

  6. Omar says:

    Thanks for this solution! It worked perfectly.

    Not sure if it helps anyone, but in my case, I found that by setting the Write-In Product field to Read-only, Locking it to the form, and hiding the “Select Product” field, the red warning has disappeared.

    I realize that a lot of people may use the Write-In field so this may not be a fix for everyone, but it’s the best I’ve got.

  7. Rute says:

    This customization is not working with Microsoft Dynamics CRM Online 2015 Update 1. We have this customization working fine in 2015 in a customer but when we try to customize in a trial instance with 2015 Update 1 it doesn’t work. Has anyone experienced this? Do you have any suggestion? Thanks

    • Joel Lindstrom says:

      Yes it does. Here is a video of it working on an environment with build https://www.youtube.com/watch?v=EI0VXEJ4-Rg
      Note–I have it running as a form level business rule and have the fields referenced in the business rule displaying on the form.

      • Rute says:

        Thank you but we have a custom opportunity product subgrid in the form and it doesn´t work the way it used to in the actual version (2015 Online). We want to select the “+” button in the subgrid and automatically open the form not the line in the subgrid. Maybe we are missing some step. Do you have any suggestion?

        • Joel Lindstrom says:

          Ok, but that isn’t what this tip is about. This tip is about making the form default to existing product lookup rather than write in. If your subgrid isn’t working the way you want it to, that is a different thing altogether. First thing to check is that the opportunity field is required on the product. If that doesn’t work, use ribbon workbench to hide the add existing button on the subgrid ribbon for opp products. That’s the furthest I can go on this one.

        • Alex A says:

          Rute – Disabling Turbo forms should resolve your issue. Give that a try.

  8. John Baptiste Bily says:

    The Easy,Simple, Stupid Way – Working on D365 v8.2 Online :

    – Just change the name of the default opportunity subgrid and it will take out the write-in product possibility.

    The hard way should be through the Ribbon Workbench :

    – hide the Write-in button / Publish

    Hope it helps

Leave a Reply

Your email address will not be published. Required fields are marked *